@graphai/vanilla

中文文档
2.0.12发布于 2025/08/18MITTypeScriptCommonJS近 30 天下载 1.7万

GraphAI的香草剂.

中文使用文档
文档目录6 节
  1. 安装
  2. 使用量
  3. 代理人说明
  4. 输入/输出/图像Schema和样本
  5. 输入/图像示例
  6. 图表数据示例

@graphai/ vanilla for GraphAI 页面存档备份,存于互联网档案馆

GraphAI的香草剂.

安装

yarn add @graphai/vanilla

使用量

import { GraphAI } from "graphai";
import { 
  arrayFindFirstExistsAgent,
  arrayFlatAgent,
  arrayJoinAgent,
  arrayToObjectAgent,
  compareAgent,
  consoleAgent,
  copy2ArrayAgent,
  copyAgent,
  copyMessageAgent,
  countingAgent,
  dataSumTemplateAgent,
  dotProductAgent,
  echoAgent,
  images2messageAgent,
  jsonParserAgent,
  lookupDictionaryAgent,
  mapAgent,
  mergeNodeIdAgent,
  mergeObjectAgent,
  nestedAgent,
  popAgent,
  propertyFilterAgent,
  pushAgent,
  shiftAgent,
  sleeperAgent,
  sortByValuesAgent,
  streamMockAgent,
  stringCaseVariantsAgent,
  stringEmbeddingsAgent,
  stringSplitterAgent,
  stringTemplateAgent,
  stringUpdateTextAgent,
  totalAgent,
  vanillaFetchAgent
 } from "@graphai/vanilla";

const agents = { 
  arrayFindFirstExistsAgent,
  arrayFlatAgent,
  arrayJoinAgent,
  arrayToObjectAgent,
  compareAgent,
  consoleAgent,
  copy2ArrayAgent,
  copyAgent,
  copyMessageAgent,
  countingAgent,
  dataSumTemplateAgent,
  dotProductAgent,
  echoAgent,
  images2messageAgent,
  jsonParserAgent,
  lookupDictionaryAgent,
  mapAgent,
  mergeNodeIdAgent,
  mergeObjectAgent,
  nestedAgent,
  popAgent,
  propertyFilterAgent,
  pushAgent,
  shiftAgent,
  sleeperAgent,
  sortByValuesAgent,
  streamMockAgent,
  stringCaseVariantsAgent,
  stringEmbeddingsAgent,
  stringSplitterAgent,
  stringTemplateAgent,
  stringUpdateTextAgent,
  totalAgent,
  vanillaFetchAgent
 };

const graph = new GraphAI(graph_data, agents);
const result = await graph.run();

代理人说明

  • 查找第一Exists 代理 - 矩阵平面代理
  • 阵列FlatAgent - 阵列平面代理
  • 阵列Join代理 - 组合代理
  • 矩阵到对象代理 - 矩阵到对象代理
  • 比较代理 - 比较
  • 控制台代理 - 只给控制台发短信。 info
  • 复制2 箭头代理 - 复制2 矩阵代理
  • 复制代理 - 返回已命名的输入
  • 复制信代理 - 复制信代理
  • 计数代理 - 计数代理
  • 数据SumTemplate 代理 - 返回输入值的总和
  • 点生产剂 - 点生产剂
  • 回声代理 - Echo代理
  • 图像2message Agent - 返回 llm 的信息数据包含图像
  • jsonParser 代理 - 模板代理
  • 查找词典代理 - 选择带有参数的元素
  • 地图代理 - 地图代理
  • 合并节点ID代理 - 合并节点ID代理
  • 合并对象代理 - 返回的输入
  • 嵌入代理 - 嵌入代理
  • 流行代理 - 流行代理
  • propertyFilter Agent - 基于属性名称的过滤器属性, 包括“ 包含 ” 、 “ 排除 ” 、 “ 修改 ” 、 “ 擦拭 ” 、 “ 插入 ” 、 “ 检查 ”
  • 推动代理 - 推动代理
  • 换行代理 - 换行代理
  • 卧底 - 卧底 测试和调试代理
  • 排序 ByValues 代理 - 排序 ByValues 代理
  • streamMock Agent - 流模拟代理
  • 字符串变量代理 - 格式字符串代理
  • 字符串Embeddings 代理 - 嵌入代理
  • 字符串分配器代理 - 使用以下参数将一个长字符串剥入块
  • 字符串模板代理 - 模板代理
  • 字符串更新文本代理 -
  • 代理 - 返回输入值之和
  • 香草FetchAgent - 从指定的 URL 获取 JSON 数据

输入/输出/图像Schema和样本

输入/图像示例

  • 查找第一个存在代理
    • 投入
      • 数组( 阵列)
        • 要找到的数组
    • 段落
{
  "inputs": {
    "array": [
      null,
      2
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      null,
      null,
      3
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      null,
      null,
      0
    ]
  },
  "params": {}
}
  • 阵列FlatAgent
    • 投入
      • 数组( 阵列)
        • 要平整的阵列
    • 段落
      • 深度( 数量)
        • 平缓深度
{
  "inputs": {
    "array": [
      [
        1
      ],
      [
        2
      ],
      [
        3
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        1
      ],
      [
        2
      ],
      [
        [
          3
        ]
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        1
      ],
      [
        2
      ],
      [
        [
          3
        ]
      ]
    ]
  },
  "params": {
    "depth": 2
  }
}
{
  "inputs": {
    "array": [
      [
        "a"
      ],
      [
        "b"
      ],
      [
        "c"
      ]
    ]
  },
  "params": {}
}
  • 数组
    • 投入
      • 数组( 阵列)
        • 数组加入
    • 段落
      • 分隔符( 字符串)
        • 数组加入分隔符
      • 平面( 数字)
        • 数组平平深度
{
  "inputs": {
    "array": [
      [
        1
      ],
      [
        2
      ],
      [
        3
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        1
      ],
      [
        2
      ],
      [
        [
          3
        ]
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        "a"
      ],
      [
        "b"
      ],
      [
        "c"
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        1
      ],
      [
        2
      ],
      [
        3
      ]
    ]
  },
  "params": {
    "separator": "|"
  }
}
{
  "inputs": {
    "array": [
      [
        [
          1
        ]
      ],
      [
        [
          2
        ],
        [
          3
        ]
      ]
    ]
  },
  "params": {
    "separator": "|"
  }
}
{
  "inputs": {
    "array": [
      [
        [
          1
        ]
      ],
      [
        [
          2
        ],
        [
          3
        ]
      ]
    ]
  },
  "params": {
    "separator": "|",
    "flat": 1
  }
}
{
  "inputs": {
    "array": [
      [
        [
          [
            1
          ]
        ],
        [
          [
            2
          ],
          [
            3
          ]
        ]
      ]
    ]
  },
  "params": {
    "separator": "|",
    "flat": 1
  }
}
{
  "inputs": {
    "array": [
      [
        [
          [
            1
          ]
        ],
        [
          [
            2
          ],
          [
            3
          ]
        ]
      ]
    ]
  },
  "params": {
    "separator": "|",
    "flat": 2
  }
}
  • 数组到对象代理
    • 投入
      • 项(阵列)
        • 从中弹出一个项的阵列
{
  "inputs": {
    "items": [
      {
        "id": 1,
        "data": "a"
      },
      {
        "id": 2,
        "data": "b"
      }
    ]
  },
  "params": {
    "key": "id"
  }
}
  • 比较代理
    • 投入
      • 数组( 阵列)
        • 3-元素阵列在窗体中[左Operand,操作员,右Operand]. 用于直接比较逻辑.
      • 左边的Value( 字符串、 数字、 布尔)
        • 不提供“ 阵列” 时使用的左手操作 。 用"右派"和"params.operator"来表示.
      • 右等值( 字符串、 数字、 布尔)
        • 不提供“ 阵列” 时使用的右手操作 。 与"左侧Value"和"params.
    • 段落
      • 运算符(字符串)
        • 应用的比较运算符,例如"==","!=",">","<","<=","||","||","&&","&&","&&"或"X"等. 如果“ 阵列” 不包括操作员, 则需要 .
      • 值(对象)
        • 比较结果的可选映射. 如果提供, 它必须包含“ truth” 和/ 或“ false” 键, 以返回自定义值, 而不是布尔值 .
{
  "inputs": {
    "array": [
      "abc",
      "==",
      "abc"
    ]
  },
  "params": {
    "value": {
      "true": "a",
      "false": "b"
    }
  }
}
{
  "inputs": {
    "array": [
      "abc",
      "==",
      "abca"
    ]
  },
  "params": {
    "value": {
      "true": "a",
      "false": "b"
    }
  }
}
{
  "inputs": {
    "array": [
      "abc",
      "==",
      "abc"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "abc",
      "==",
      "abcd"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "abc",
      "!=",
      "abc"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "abc",
      "!=",
      "abcd"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      ">",
      "5"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      ">",
      "15"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      ">",
      5
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      ">",
      15
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      ">=",
      "5"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      ">=",
      "10"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      ">=",
      "19"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      ">=",
      5
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      ">=",
      10
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      ">=",
      19
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      "<",
      "5"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      "<",
      "15"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      "<",
      5
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      "<",
      15
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      "<=",
      "5"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      "<=",
      "10"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "10",
      "<=",
      "19"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      "<=",
      5
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      "<=",
      10
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      10,
      "<=",
      19
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      true,
      "||",
      false
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      false,
      "||",
      false
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      true,
      "&&",
      false
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      true,
      "&&",
      true
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      true,
      "XOR",
      false
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      false,
      "XOR",
      true
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      false,
      "XOR",
      false
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      true,
      "XOR",
      true
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        "aaa",
        "==",
        "aaa"
      ],
      "||",
      [
        "aaa",
        "==",
        "bbb"
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        "aaa",
        "==",
        "aaa"
      ],
      "&&",
      [
        "aaa",
        "==",
        "bbb"
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        [
          "aaa",
          "==",
          "aaa"
        ],
        "&&",
        [
          "bbb",
          "==",
          "bbb"
        ]
      ],
      "||",
      [
        "aaa",
        "&&",
        "bbb"
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "abc",
      "abc"
    ]
  },
  "params": {
    "value": {
      "true": "a",
      "false": "b"
    },
    "operator": "=="
  }
}
{
  "inputs": {
    "array": [
      "abc",
      "abca"
    ]
  },
  "params": {
    "value": {
      "true": "a",
      "false": "b"
    },
    "operator": "=="
  }
}
{
  "inputs": {
    "array": [
      "abc",
      "abc"
    ]
  },
  "params": {
    "operator": "=="
  }
}
{
  "inputs": {
    "array": [
      "abc",
      "abcd"
    ]
  },
  "params": {
    "operator": "=="
  }
}
{
  "inputs": {
    "array": [
      "abc",
      "abc"
    ]
  },
  "params": {
    "operator": "!="
  }
}
{
  "inputs": {
    "array": [
      "abc",
      "abcd"
    ]
  },
  "params": {
    "operator": "!="
  }
}
{
  "inputs": {
    "array": [
      "10",
      "5"
    ]
  },
  "params": {
    "operator": ">"
  }
}
{
  "inputs": {
    "array": [
      "10",
      "15"
    ]
  },
  "params": {
    "operator": ">"
  }
}
{
  "inputs": {
    "array": [
      10,
      5
    ]
  },
  "params": {
    "operator": ">"
  }
}
{
  "inputs": {
    "array": [
      10,
      15
    ]
  },
  "params": {
    "operator": ">"
  }
}
{
  "inputs": {
    "array": [
      "10",
      "5"
    ]
  },
  "params": {
    "operator": ">="
  }
}
{
  "inputs": {
    "array": [
      "10",
      "10"
    ]
  },
  "params": {
    "operator": ">="
  }
}
{
  "inputs": {
    "array": [
      "10",
      "19"
    ]
  },
  "params": {
    "operator": ">="
  }
}
{
  "inputs": {
    "array": [
      10,
      5
    ]
  },
  "params": {
    "operator": ">="
  }
}
{
  "inputs": {
    "array": [
      10,
      10
    ]
  },
  "params": {
    "operator": ">="
  }
}
{
  "inputs": {
    "array": [
      10,
      19
    ]
  },
  "params": {
    "operator": ">="
  }
}
{
  "inputs": {
    "array": [
      "10",
      "5"
    ]
  },
  "params": {
    "operator": "<"
  }
}
{
  "inputs": {
    "array": [
      "10",
      "15"
    ]
  },
  "params": {
    "operator": "<"
  }
}
{
  "inputs": {
    "array": [
      10,
      5
    ]
  },
  "params": {
    "operator": "<"
  }
}
{
  "inputs": {
    "array": [
      10,
      15
    ]
  },
  "params": {
    "operator": "<"
  }
}
{
  "inputs": {
    "array": [
      true,
      false
    ]
  },
  "params": {
    "operator": "||"
  }
}
{
  "inputs": {
    "array": [
      false,
      false
    ]
  },
  "params": {
    "operator": "||"
  }
}
{
  "inputs": {
    "array": [
      true,
      false
    ]
  },
  "params": {
    "operator": "&&"
  }
}
{
  "inputs": {
    "array": [
      true,
      true
    ]
  },
  "params": {
    "operator": "&&"
  }
}
{
  "inputs": {
    "array": [
      true,
      false
    ]
  },
  "params": {
    "operator": "XOR"
  }
}
{
  "inputs": {
    "array": [
      false,
      true
    ]
  },
  "params": {
    "operator": "XOR"
  }
}
{
  "inputs": {
    "array": [
      false,
      false
    ]
  },
  "params": {
    "operator": "XOR"
  }
}
{
  "inputs": {
    "array": [
      true,
      true
    ]
  },
  "params": {
    "operator": "XOR"
  }
}
{
  "inputs": {
    "leftValue": "abc",
    "rightValue": "abc"
  },
  "params": {
    "value": {
      "true": "a",
      "false": "b"
    },
    "operator": "=="
  }
}
{
  "inputs": {
    "leftValue": "abc",
    "rightValue": "abca"
  },
  "params": {
    "value": {
      "true": "a",
      "false": "b"
    },
    "operator": "=="
  }
}
  • 控制台代理
    • 投入
      • 文本(字符串)
        • 文本
{
  "inputs": {
    "text": "hello"
  },
  "params": {}
}
  • 复制2 箭头代理
    • 投入
      • 项( 未定义)
        • 复制到生成数组的每个元素的项目 .
    • 段落
      • 计数(整数)
        • 将输入项目复制到输出阵列的次数 .
{
  "inputs": {
    "item": {
      "message": "hello"
    }
  },
  "params": {
    "count": 10
  }
}
{
  "inputs": {
    "message": "hello"
  },
  "params": {
    "count": 10
  }
}
{
  "inputs": {
    "item": "hello"
  },
  "params": {
    "count": 10
  }
}
  • 复制代理人
    • 投入

    • 段落

      • 命名为 Key( 字符串)
        • 如果指定, 代理将只从命名的输入返回与此密钥相关的值 .
{
  "inputs": {
    "color": "red",
    "model": "Model 3"
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "Hello World",
      "Discarded"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "color": "red",
    "model": "Model 3"
  },
  "params": {
    "namedKey": "color"
  }
}
  • 复制对象
    • 投入

    • 段落

      • 计数(整数)
        • 数组中信件的重复次数 .
      • 信件(字符串)
        • 要重复的信件字符串 .
{
  "inputs": {},
  "params": {
    "count": 4,
    "message": "hello"
  }
}
  • 计数 探员
    • 投入

    • 段落

      • 计数(整数)
        • 要生成的整数, 从 0 到 数 - 1.
{
  "inputs": {},
  "params": {
    "count": 4
  }
}
  • 数据SumTemplate 代理
    • 投入
      • 数组( 阵列)
        • 计算总和的数组
{
  "inputs": {
    "array": [
      1
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      1,
      2
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      1,
      2,
      3
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      1
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      1,
      2
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      1,
      2,
      3
    ]
  },
  "params": {
    "flatResponse": true
  }
}
  • 点生产代理商
    • 投入
      • 矩阵( 阵列)
        • 二维数相. 每个内数组代表一个要比较的向量.
      • 向量( 阵列)
        • 一个数字的单一矢量,以计算矩阵中每个矢量的点出产物.
    • 段落
{
  "inputs": {
    "matrix": [
      [
        1,
        2
      ],
      [
        3,
        4
      ],
      [
        5,
        6
      ]
    ],
    "vector": [
      3,
      2
    ]
  },
  "params": {}
}
{
  "inputs": {
    "matrix": [
      [
        1,
        2
      ],
      [
        2,
        3
      ]
    ],
    "vector": [
      1,
      2
    ]
  },
  "params": {}
}
  • 回声代理
    • 投入

    • 段落

      • 滤波器( 布尔)
        • 如果为真, 返回“ filterParams” 而不是完整的“ params ” .
{
  "inputs": {},
  "params": {
    "text": "this is test"
  }
}
{
  "inputs": {},
  "params": {
    "text": "If you add filterParams option, it will respond to filterParams",
    "filterParams": true
  }
}
  • 图像2消息代理
    • 投入
      • 数组( 阵列)
        • 一组基数64-编码的图像数据字符串或图像 URL. 这些将被转换为OpenAI Vision-兼容图像消息格式.
      • 提示( 字符串)
        • 可选的快速文本将包含在图像之前的第一个消息内容 .
    • 段落
      • 图像类型( 字符串)
        • 图像输入类型: Base64的"png","jpg"等,或图像URL的"http".
      • 细节( 字符串)
        • 模型所要求的图像细节级别(如"自发","低","高"等). 可选的.
{
  "inputs": {
    "array": [
      "abcabc",
      "122123"
    ]
  },
  "params": {
    "imageType": "png"
  }
}
{
  "inputs": {
    "array": [
      "abcabc",
      "122123"
    ],
    "prompt": "hello"
  },
  "params": {
    "imageType": "jpg",
    "detail": "high"
  }
}
{
  "inputs": {
    "array": [
      "http://example.com/1.jpg",
      "http://example.com/2.jpg"
    ]
  },
  "params": {
    "imageType": "http"
  }
}
  • jsonParser 代理服务器
    • 投入
      • 文本(字符串)
        • 一个JSON字符串,可能嵌入了Markdown代码块. 如果提供,将解析为数据对象.
      • 数据( 未定义)
        • 在“ text” 输出中将原始数据转换为格式化的 JSON 字符串 .
    • 段落
{
  "inputs": {
    "data": {
      "apple": "red",
      "lemon": "yellow"
    }
  },
  "params": {}
}
{
  "inputs": {
    "text": "{\n  \"apple\": \"red\",\n  \"lemon\": \"yellow\"\n}"
  },
  "params": {}
}
{
  "inputs": {
    "text": "```\n{\"apple\":\"red\",\"lemon\":\"yellow\"}\n```"
  },
  "params": {}
}
{
  "inputs": {
    "text": "```json\n{\"apple\":\"red\",\"lemon\":\"yellow\"}\n```"
  },
  "params": {}
}
{
  "inputs": {
    "text": "```JSON\n{\"apple\":\"red\",\"lemon\":\"yellow\"}\n```"
  },
  "params": {}
}
  • 搜索词典代理
    • 投入
      • 命名为 Key( 字符串)
        • 在“ params” 提供的词典中查找的密钥 .
      • supress Error( 布尔)
        • 如果为真, 则在“ params” 中缺少密钥时, 防止代理机出错 。 可选的.
    • 段落
{
  "inputs": {
    "namedKey": "openai"
  },
  "params": {
    "openai": {
      "model": "gpt4-o",
      "temperature": 0.7
    },
    "groq": {
      "model": "llama3-8b-8192",
      "temperature": 0.6
    },
    "gemini": {
      "model": "gemini-2.0-pro-exp-02-05",
      "temperature": 0.7
    }
  }
}
{
  "inputs": {
    "namedKey": "gemini"
  },
  "params": {
    "openai": {
      "model": "gpt4-o",
      "temperature": 0.7
    },
    "groq": {
      "model": "llama3-8b-8192",
      "temperature": 0.6
    },
    "gemini": {
      "model": "gemini-2.0-pro-exp-02-05",
      "temperature": 0.7
    }
  }
}
  • 地图代理
{
  "inputs": {
    "rows": [
      "apple",
      "orange",
      "banana",
      "lemon"
    ],
    "color": [
      "red",
      "orange",
      "yellow",
      "yellow"
    ]
  },
  "params": {
    "compositeResult": true,
    "expandKeys": [
      "color"
    ]
  }
}
{
  "inputs": {
    "rows": [
      1,
      2
    ]
  },
  "params": {}
}
{
  "inputs": {
    "rows": [
      1,
      2
    ]
  },
  "params": {
    "rowKey": "myKey"
  }
}
{
  "inputs": {
    "rows": [
      "apple",
      "orange",
      "banana",
      "lemon",
      "melon",
      "pineapple",
      "tomato"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "rows": [
      {
        "fruit": "apple"
      },
      {
        "fruit": "orange"
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "rows": [
      {
        "fruit": "apple"
      },
      {
        "fruit": "orange"
      }
    ],
    "name": "You",
    "verb": "like"
  },
  "params": {}
}
{
  "inputs": {
    "rows": [
      1,
      2
    ]
  },
  "params": {
    "resultAll": true
  }
}
{
  "inputs": {
    "rows": [
      1,
      2
    ]
  },
  "params": {
    "resultAll": true
  }
}
{
  "inputs": {
    "rows": [
      1,
      2
    ]
  },
  "params": {
    "compositeResult": true
  }
}
{
  "inputs": {
    "rows": [
      "apple",
      "orange",
      "banana",
      "lemon",
      "melon",
      "pineapple",
      "tomato"
    ]
  },
  "params": {
    "compositeResult": true
  }
}
{
  "inputs": {
    "rows": [
      "apple",
      "orange",
      "banana",
      "lemon",
      "melon",
      "pineapple",
      "tomato"
    ]
  },
  "params": {
    "compositeResult": true,
    "compositeResultKey": "node2"
  }
}
{
  "inputs": {
    "rows": [
      1,
      2
    ]
  },
  "params": {
    "resultAll": true,
    "compositeResult": true
  }
}
{
  "inputs": {
    "rows": [
      1,
      2
    ]
  },
  "params": {
    "resultAll": true,
    "compositeResult": true
  }
}
  • 合并节点ID代理
    • 投入
      • 数组( 阵列)
        • 要合并成单个对象的一组对象。 每个对象代表部分结果或状态.
    • 段落
{
  "inputs": {
    "array": [
      {
        "message": "hello"
      }
    ]
  },
  "params": {}
}
  • 合并对象代理
    • 投入
      • 项(阵列)
        • 一组对象的密钥值对将合并为一个单一对象。 后期对象在密钥冲突上覆盖了更早的对象 .
    • 段落
{
  "inputs": {
    "items": [
      {
        "color": "red"
      },
      {
        "model": "Model 3"
      }
    ]
  },
  "params": {}
}
  • 嵌入剂
{
  "inputs": {
    "message": "hello"
  },
  "params": {}
}
{
  "inputs": {
    "message": "hello"
  },
  "params": {
    "resultNodeId": "test"
  }
}
{
  "inputs": {
    "loopCount": 5
  },
  "params": {
    "resultNodeId": "test"
  }
}
  • 弹出代理
    • 投入
      • 数组( 阵列)
        • 从中弹出一个项的阵列
{
  "inputs": {
    "array": [
      1,
      2,
      3
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "a",
      "b",
      "c"
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      1,
      2,
      3
    ],
    "array2": [
      "a",
      "b",
      "c"
    ]
  },
  "params": {}
}
  • 客户端
    • 投入
{
  "inputs": {
    "array": [
      {
        "color": "red",
        "model": "Model 3",
        "type": "EV",
        "maker": "Tesla",
        "range": 300
      }
    ]
  },
  "params": {
    "include": [
      "color",
      "model"
    ]
  }
}
{
  "inputs": {
    "item": {
      "color": "red",
      "model": "Model 3",
      "type": "EV",
      "maker": "Tesla",
      "range": 300
    }
  },
  "params": {
    "include": [
      "color",
      "model"
    ]
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "color": "red",
          "model": "Model 3",
          "type": "EV",
          "maker": "Tesla",
          "range": 300
        },
        {
          "color": "blue",
          "model": "Model Y",
          "type": "EV",
          "maker": "Tesla",
          "range": 400
        }
      ],
      "Tesla Motors"
    ]
  },
  "params": {
    "include": [
      "color",
      "model"
    ]
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "color": "red",
          "model": "Model 3",
          "type": "EV",
          "maker": "Tesla",
          "range": 300
        },
        {
          "color": "blue",
          "model": "Model Y",
          "type": "EV",
          "maker": "Tesla",
          "range": 400
        }
      ],
      "Tesla Motors"
    ]
  },
  "params": {
    "exclude": [
      "color",
      "model"
    ]
  }
}
{
  "inputs": {
    "item": {
      "color": "red",
      "model": "Model 3",
      "type": "EV",
      "maker": "Tesla",
      "range": 300
    }
  },
  "params": {
    "exclude": [
      "color",
      "model"
    ]
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "color": "red",
          "model": "Model 3",
          "type": "EV",
          "maker": "Tesla",
          "range": 300
        },
        {
          "color": "blue",
          "model": "Model Y",
          "type": "EV",
          "maker": "Tesla",
          "range": 400
        }
      ],
      "Tesla Motors"
    ]
  },
  "params": {
    "alter": {
      "color": {
        "red": "blue",
        "blue": "red"
      }
    }
  }
}
{
  "inputs": {
    "item": {
      "color": "red",
      "model": "Model 3",
      "type": "EV",
      "maker": "Tesla",
      "range": 300
    }
  },
  "params": {
    "alter": {
      "color": {
        "red": "blue",
        "blue": "red"
      }
    }
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "color": "red",
          "model": "Model 3",
          "type": "EV",
          "maker": "Tesla",
          "range": 300
        },
        {
          "color": "blue",
          "model": "Model Y",
          "type": "EV",
          "maker": "Tesla",
          "range": 400
        }
      ],
      "Tesla Motors"
    ]
  },
  "params": {
    "swap": {
      "maker": "model"
    }
  }
}
{
  "inputs": {
    "item": {
      "color": "red",
      "model": "Model 3",
      "type": "EV",
      "maker": "Tesla",
      "range": 300
    }
  },
  "params": {
    "swap": {
      "maker": "model"
    }
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "color": "red",
          "model": "Model 3",
          "type": "EV",
          "maker": "Tesla",
          "range": 300
        },
        {
          "color": "blue",
          "model": "Model Y",
          "type": "EV",
          "maker": "Tesla",
          "range": 400
        }
      ],
      "Tesla Motors"
    ]
  },
  "params": {
    "inject": [
      {
        "propId": "maker",
        "from": 1
      }
    ]
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "color": "red",
          "model": "Model 3",
          "type": "EV",
          "maker": "Tesla",
          "range": 300
        },
        {
          "color": "blue",
          "model": "Model Y",
          "type": "EV",
          "maker": "Tesla",
          "range": 400
        }
      ],
      "Tesla Motors"
    ]
  },
  "params": {
    "inject": [
      {
        "propId": "maker",
        "from": 1,
        "index": 0
      }
    ]
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "color": "red",
          "model": "Model 3",
          "type": "EV",
          "maker": "Tesla",
          "range": 300
        },
        {
          "color": "blue",
          "model": "Model Y",
          "type": "EV",
          "maker": "Tesla",
          "range": 400
        }
      ],
      "Tesla Motors"
    ]
  },
  "params": {
    "inspect": [
      {
        "propId": "isTesla",
        "equal": "Tesla Motors"
      },
      {
        "propId": "isGM",
        "notEqual": "Tesla Motors",
        "from": 1
      }
    ]
  }
}
  • 推动代理
    • 投入
      • 数组( 阵列)
        • 将项目推向的阵列
      • 项( 未定义)
        • 将项目推入数组
      • 项(阵列)
        • 将项目推入阵列
{
  "inputs": {
    "array": [
      1,
      2
    ],
    "item": 3
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      true,
      false
    ],
    "item": false
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      1,
      2
    ],
    "item": 3,
    "data": {
      "example": "hello"
    }
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "apple": 1
      }
    ],
    "item": {
      "lemon": 2
    }
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "apple": 1
      }
    ],
    "items": [
      {
        "lemon": 2
      },
      {
        "banana": 3
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      1,
      2
    ],
    "item": 3
  },
  "params": {
    "arrayKey": "test"
  }
}
  • 换行代理
    • 投入
      • 数组( 阵列)
        • 将项目从
{
  "inputs": {
    "array": [
      1,
      2,
      3
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "a",
      "b",
      "c"
    ]
  },
  "params": {}
}
  • 卧底代理
    • 投入

    • 段落

      • 期限(数目)
        • 可选持续时间以毫秒计, 在返回输入前暂停执行 。 默认为10ms.
{
  "inputs": {},
  "params": {
    "duration": 1
  }
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "b": 2
      }
    ]
  },
  "params": {
    "duration": 1
  }
}
  • 类型
    • 投入
      • 数组( 阵列)
        • 要排序的项目数组 。 每个项目都将从“ 值” 阵列中以相应的数值对齐 .
      • 值( 阵列)
        • 用于确定“ 阵列” 项目排序的数组数值 。 一定和"阵列"一样长.
    • 段落
      • 缓存( 布尔)
        • 若为真,则按升序排序;否则,按降序排序(默认).
{
  "inputs": {
    "array": [
      "banana",
      "orange",
      "lemon",
      "apple"
    ],
    "values": [
      2,
      5,
      6,
      4
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      "banana",
      "orange",
      "lemon",
      "apple"
    ],
    "values": [
      2,
      5,
      6,
      4
    ]
  },
  "params": {
    "assendant": true
  }
}
  • 流媒体代理
    • 投入
{
  "inputs": {},
  "params": {
    "message": "this is params test"
  }
}
{
  "inputs": {
    "message": "this is named inputs test"
  },
  "params": {}
}
  • 字符串变量
    • 投入
      • 文本(字符串)
        • 要被转换成各种外壳样式的输入字符串.
    • 段落
      • 后缀( 字符串)
        • 在转换大小写前附加到输入字符串的可选后缀 .
{
  "inputs": {
    "text": "this is a pen"
  },
  "params": {}
}
{
  "inputs": {
    "text": "string case variants"
  },
  "params": {
    "suffix": "agent"
  }
}
  • 字符串分配器代理
    • 投入
      • 文本(字符串)
        • 要剪切的文本
{
  "inputs": {
    "text": "Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes ... the ones who see things differently -- they're not fond of rules, and they have no respect for the status quo. ... You can quote them, disagree with them, glorify or vilify them, but the only thing you can't do is ignore them because they change things. ... They push the human race forward, and while some may see them as the crazy ones, we see genius, because the people who are crazy enough to think that they can change the world, are the ones who do."
  },
  "params": {
    "chunkSize": 64
  }
}
  • 字符串模板代理
    • 投入

    • 段落

      • 模板( 未定义)
        • ${ key} 这样的占位符将替换为“ 输入” 值的模板结构 .
{
  "inputs": {
    "message1": "hello",
    "message2": "test"
  },
  "params": {
    "template": "${message1}: ${message2}"
  }
}
{
  "inputs": {
    "message1": "hello",
    "message2": "test"
  },
  "params": {
    "template": [
      "${message1}: ${message2}",
      "${message2}: ${message1}"
    ]
  }
}
{
  "inputs": {
    "message1": "hello",
    "message2": "test"
  },
  "params": {
    "template": {
      "apple": "${message1}",
      "lemon": "${message2}"
    }
  }
}
{
  "inputs": {
    "message1": "hello",
    "message2": "test"
  },
  "params": {
    "template": [
      {
        "apple": "${message1}",
        "lemon": "${message2}"
      }
    ]
  }
}
{
  "inputs": {
    "message1": "hello",
    "message2": "test"
  },
  "params": {
    "template": {
      "apple": "${message1}",
      "lemon": [
        "${message2}"
      ]
    }
  }
}
{
  "inputs": {
    "agent": "openAiAgent",
    "row": "hello world",
    "params": {
      "text": "message"
    }
  },
  "params": {
    "template": {
      "version": 0.5,
      "nodes": {
        "ai": {
          "agent": "${agent}",
          "isResult": true,
          "params": "${params}",
          "inputs": {
            "prompt": "${row}"
          }
        }
      }
    }
  }
}
  • 字符串更新文本代理
    • 投入
      • 新Text( 字符串)
        • 如果提供而非空的要使用的新文本 .
      • 旧文本( 字符串)
        • 如果“ newText” 是空的或未提供, 则使用倒置文本 .
    • 段落
{
  "inputs": {
    "newText": "new",
    "oldText": "old"
  },
  "params": {}
}
{
  "inputs": {
    "newText": "",
    "oldText": "old"
  },
  "params": {}
}
{
  "inputs": {},
  "params": {}
}
{
  "inputs": {
    "oldText": "old"
  },
  "params": {}
}
  • 共计
    • 投入
      • 数组( 阵列)
        • 一系列对象或一系列对象。 每个内对象必须具有按键相加的数值.
    • 段落
      • 平方响应( 布尔)
        • 如果为真,则结果将作为普通对象(如{a: 6})返回; 否则, 包裹在{数据: {...}} 中.
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2
      },
      {
        "a": 3
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      [
        {
          "a": 1,
          "b": -1
        },
        {
          "c": 10
        }
      ],
      [
        {
          "a": 2,
          "b": -1
        }
      ],
      [
        {
          "a": 3,
          "b": -2
        },
        {
          "d": -10
        }
      ]
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2
      },
      {
        "a": 3
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "a": 1,
        "b": 1
      },
      {
        "a": 2,
        "b": 2
      },
      {
        "a": 3,
        "b": 0
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2,
        "b": 2
      },
      {
        "a": 3,
        "b": 0
      }
    ]
  },
  "params": {}
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2
      },
      {
        "a": 3
      }
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      [
        {
          "a": 1,
          "b": -1
        },
        {
          "c": 10
        }
      ],
      [
        {
          "a": 2,
          "b": -1
        }
      ],
      [
        {
          "a": 3,
          "b": -2
        },
        {
          "d": -10
        }
      ]
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      }
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2
      }
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2
      },
      {
        "a": 3
      }
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      {
        "a": 1,
        "b": 1
      },
      {
        "a": 2,
        "b": 2
      },
      {
        "a": 3,
        "b": 0
      }
    ]
  },
  "params": {
    "flatResponse": true
  }
}
{
  "inputs": {
    "array": [
      {
        "a": 1
      },
      {
        "a": 2,
        "b": 2
      },
      {
        "a": 3,
        "b": 0
      }
    ]
  },
  "params": {
    "flatResponse": true
  }
}
  • 香草剂
    • 投入
      • url( 字符串)
        • 请求 URL 。 可以在“输入”或“参数”中提供.
      • 方法(字符串)
        • 要使用的HTTP方法(GET, POST, PUT等). 未指定且未提供尸体的默认获取; 否则为 POST .
      • 页眉( 对象)
        • 可选的 HTTP 信头包含在请求中 。 输入值和参数值合并.
      • 查询Params( 对象)
        • 附加到 URL 的可选查询参数 .
      • 正文( 未定义)
        • 可选请求机构以 POST, PUT, 或 PATCH 方法发送.
    • 段落
      • url( 字符串)
        • 请求 URL( 如果输入中也指定, 覆盖) .
      • 方法(字符串)
        • HTTP 方法( 如果输入中也指定的话, 覆盖) .
      • 页眉( 对象)
        • 外加头相. 和输入物合并 头部.
      • 查询Params( 对象)
        • 要附加到 URL 的查询参数 .
      • 正文( 未定义)
        • 请求发送正文,与POST/PUT/PATCH使用.
      • 调试( 布尔)
        • 如果为真, 请返回已准备的请求细节, 而不是执行实际获取 .
      • supress Error( 布尔)
        • 如果为真,则按下抛出的错误并返回错误响应.
      • 平方响应( 布尔)
        • 如果真实, 则返回原始响应 。 如果错误,则用“data”键将响应包入对象中。 默认是虚假的.
      • 类型(字符串)
        • 解析的反应类型 。 要么是"json" 要么是"text". 默认为"json" .
{
  "inputs": {
    "url": "https://example.com",
    "queryParams": {
      "foo": "bar"
    },
    "headers": {
      "x-myHeader": "secret"
    }
  },
  "params": {
    "debug": true
  }
}
{
  "inputs": {
    "url": "https://example.com",
    "body": {
      "foo": "bar"
    }
  },
  "params": {
    "debug": true
  }
}
{
  "inputs": {
    "url": "https://example.com",
    "body": {
      "foo": "bar"
    },
    "method": "PUT"
  },
  "params": {
    "debug": true
  }
}
{
  "inputs": {
    "url": "https://example.com",
    "method": "options"
  },
  "params": {
    "debug": true
  }
}
{
  "inputs": {},
  "params": {
    "url": "https://example.com",
    "body": {
      "foo": "bar"
    },
    "method": "PUT",
    "debug": true
  }
}
{
  "inputs": {
    "method": "DELETE",
    "headers": {
      "authentication": "bearer XXX"
    }
  },
  "params": {
    "url": "https://example.com",
    "body": {
      "foo": "bar"
    },
    "method": "PUT",
    "headers": {
      "Content-Type": "application/json"
    },
    "debug": true
  }
}

图表数据示例

动态图形数据

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": {
        "version": 0.5,
        "loop": {
          "count": 5
        },
        "nodes": {
          "array": {
            "value": [],
            "update": ":reducer.array"
          },
          "item": {
            "agent": "sleepAndMergeAgent",
            "params": {
              "duration": 10,
              "value": "hello"
            }
          },
          "reducer": {
            "isResult": true,
            "agent": "pushAgent",
            "inputs": {
              "array": ":array",
              "item": ":item"
            }
          }
        }
      }
    },
    "nested": {
      "agent": "nestedAgent",
      "graph": ":source",
      "isResult": true
    }
  }
}

动态 GraphData2

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": "{\"version\":0.5,\"loop\":{\"count\":5},\"nodes\":{\"array\":{\"value\":[],\"update\":\":reducer.array\"},\"item\":{\"agent\":\"sleepAndMergeAgent\",\"params\":{\"duration\":10,\"value\":\"hello\"}},\"reducer\":{\"isResult\":true,\"agent\":\"pushAgent\",\"inputs\":{\"array\":\":array\",\"item\":\":item\"}}}}"
    },
    "parser": {
      "agent": "jsonParserAgent",
      "inputs": {
        "text": ":source"
      }
    },
    "nested": {
      "agent": "nestedAgent",
      "graph": ":parser.data",
      "isResult": true
    }
  }
}

动态 GraphData3

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": "```json\n{\"version\":0.5,\"loop\":{\"count\":5},\"nodes\":{\"array\":{\"value\":[],\"update\":\":reducer.array\"},\"item\":{\"agent\":\"sleepAndMergeAgent\",\"params\":{\"duration\":10,\"value\":\"hello\"}},\"reducer\":{\"isResult\":true,\"agent\":\"pushAgent\",\"inputs\":{\"array\":\":array\",\"item\":\":item\"}}}}\n```\n"
    },
    "parser": {
      "agent": "jsonParserAgent",
      "inputs": {
        "text": ":source"
      }
    },
    "nested": {
      "agent": "nestedAgent",
      "graph": ":parser.data",
      "isResult": true
    }
  }
}

嵌入式GraphData 数据

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": "Hello World"
    },
    "nestedNode": {
      "agent": "nestedAgent",
      "inputs": {
        "inner0": ":source"
      },
      "isResult": true,
      "graph": {
        "nodes": {
          "resultInner": {
            "agent": "copyAgent",
            "inputs": {
              "text": ":inner0"
            },
            "isResult": true
          }
        }
      }
    }
  }
}

被嵌入的 GraphData2

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": "Hello World"
    },
    "nestedNode": {
      "agent": "nestedAgent",
      "inputs": {
        "source": ":source"
      },
      "isResult": true,
      "graph": {
        "nodes": {
          "result": {
            "agent": "copyAgent",
            "inputs": {
              "text": ":source"
            },
            "isResult": true
          }
        }
      }
    }
  }
}

图表数据映射1

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": {
        "fruits": [
          "apple",
          "orange",
          "banana",
          "lemon",
          "melon",
          "pineapple",
          "tomato"
        ]
      }
    },
    "nestedNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":source.fruits"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "node2": {
            "agent": "stringTemplateAgent",
            "params": {
              "template": "I love ${m}."
            },
            "inputs": {
              "m": ":row"
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "result": {
      "agent": "sleepAndMergeAgent",
      "inputs": {
        "array": [
          ":nestedNode.node2"
        ]
      },
      "isResult": true
    }
  }
}

图表数据映射3

{
  "version": 0.5,
  "nodes": {
    "source1": {
      "value": [
        "hello",
        "hello2"
      ]
    },
    "nestedNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":source1"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "node1": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "row"
            },
            "inputs": {
              "row": ":row"
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "result": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "result"
      },
      "inputs": {
        "result": [
          ":nestedNode.node1"
        ]
      },
      "isResult": true
    }
  }
}

图表数据映射4

{
  "version": 0.5,
  "nodes": {
    "source1": {
      "value": [
        "hello",
        "hello2"
      ]
    },
    "nestedNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":source1"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "node1": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "row"
            },
            "inputs": {
              "row": ":row"
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "result": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "result"
      },
      "inputs": {
        "result": ":nestedNode.node1"
      }
    }
  }
}

图表数据映射5

{
  "version": 0.5,
  "nodes": {
    "source1": {
      "value": [
        "hello",
        "hello2"
      ]
    },
    "nestedNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":source1"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "node1": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "row"
            },
            "inputs": {
              "row": ":row"
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "result": {
      "agent": "copyAgent",
      "params": {
        "flat": 2,
        "namedKey": "res"
      },
      "inputs": {
        "res": ":nestedNode.node1"
      }
    }
  }
}

图表数据推

{
  "version": 0.5,
  "loop": {
    "count": 10
  },
  "nodes": {
    "array": {
      "value": [],
      "update": ":reducer.array"
    },
    "item": {
      "agent": "sleepAndMergeAgent",
      "params": {
        "duration": 10,
        "value": "hello"
      }
    },
    "reducer": {
      "isResult": true,
      "agent": "pushAgent",
      "inputs": {
        "array": ":array",
        "item": ":item"
      }
    }
  }
}

图表数据Pop

{
  "version": 0.5,
  "loop": {
    "while": ":source"
  },
  "nodes": {
    "source": {
      "value": [
        "orange",
        "banana",
        "lemon"
      ],
      "update": ":popper.array"
    },
    "result": {
      "value": [],
      "update": ":reducer.array"
    },
    "popper": {
      "inputs": {
        "array": ":source"
      },
      "agent": "popAgent"
    },
    "reducer": {
      "agent": "pushAgent",
      "inputs": {
        "array": ":result",
        "item": ":popper.item"
      }
    }
  }
}

图解

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": "hello"
    },
    "parent": {
      "agent": "nestedAgent",
      "inputs": {
        "source": ":source"
      },
      "isResult": true,
      "graph": {
        "loop": {
          "count": 10
        },
        "nodes": {
          "array": {
            "value": [],
            "update": ":reducer.array"
          },
          "item": {
            "agent": "copyAgent",
            "inputs": {
              "value": ":source"
            }
          },
          "reducer": {
            "agent": "pushAgent",
            "inputs": {
              "array": ":array",
              "item": ":item.value"
            },
            "isResult": true
          }
        }
      }
    }
  }
}

图表数据NestedPop

{
  "version": 0.5,
  "nodes": {
    "fruits": {
      "value": [
        "orange",
        "banana",
        "lemon"
      ]
    },
    "parent": {
      "agent": "nestedAgent",
      "isResult": true,
      "inputs": {
        "fruits": ":fruits"
      },
      "graph": {
        "loop": {
          "while": ":fruits"
        },
        "nodes": {
          "fruits": {
            "value": [],
            "update": ":popper.array"
          },
          "result": {
            "value": [],
            "update": ":reducer.array",
            "isResult": true
          },
          "popper": {
            "inputs": {
              "array": ":fruits"
            },
            "agent": "popAgent"
          },
          "reducer": {
            "agent": "pushAgent",
            "inputs": {
              "array": ":result",
              "item": ":popper.item"
            }
          }
        }
      }
    }
  }
}

图Data上注

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": "hello"
    },
    "parent": {
      "agent": "nestedAgent",
      "inputs": {
        "inner_source": ":source"
      },
      "isResult": true,
      "graph": {
        "loop": {
          "count": 10
        },
        "nodes": {
          "array": {
            "value": [],
            "update": ":reducer.array"
          },
          "item": {
            "agent": "copyAgent",
            "inputs": {
              "value": ":inner_source"
            }
          },
          "reducer": {
            "agent": "pushAgent",
            "inputs": {
              "array": ":array",
              "item": ":item.value"
            },
            "isResult": true
          }
        }
      }
    }
  }
}

叉纹

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": {
        "content": [
          {
            "level1": {
              "level2": "hello1"
            }
          },
          {
            "level1": {
              "level2": "hello2"
            }
          }
        ]
      }
    },
    "mapNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":source.content"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "workingMemory": {
            "value": {}
          },
          "forked": {
            "agent": "sleepAndMergeAgent",
            "inputs": {
              "array": [
                ":row.level1"
              ]
            }
          },
          "forked2": {
            "agent": "sleepAndMergeAgent",
            "inputs": {
              "array": [
                ":forked"
              ]
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "copyAgent": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "result"
      },
      "inputs": {
        "result": [
          ":mapNode"
        ]
      }
    }
  }
}

图表数据Bypass

{
  "version": 0.5,
  "nodes": {
    "echo": {
      "agent": "echoAgent",
      "params": {
        "message": "hello"
      }
    },
    "copyAgent": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "text"
      },
      "inputs": {
        "text": [
          ":echo"
        ]
      }
    },
    "copyAgent2": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "text"
      },
      "inputs": {
        "text": [
          ":copyAgent.$0"
        ]
      }
    }
  }
}

图表数据Bypass2

{
  "version": 0.5,
  "nodes": {
    "echo": {
      "agent": "echoAgent",
      "params": {
        "message": [
          "hello",
          "hello"
        ]
      }
    },
    "mapNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":echo.message"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "copyAgent": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "row"
            },
            "inputs": {
              "row": ":row"
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "copyAgent2": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "array"
      },
      "inputs": {
        "array": [
          ":mapNode.copyAgent"
        ]
      }
    }
  }
}

图表数据Bypass3

{
  "version": 0.5,
  "nodes": {
    "echo": {
      "agent": "echoAgent",
      "params": {
        "message": [
          "hello",
          "hello"
        ]
      }
    },
    "mapNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":echo.message"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "copyAgent": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "row"
            },
            "inputs": {
              "row": [
                ":row"
              ]
            }
          },
          "copyAgent2": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "text"
            },
            "inputs": {
              "text": ":copyAgent"
            }
          },
          "copyAgent3": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "text"
            },
            "inputs": {
              "text": ":copyAgent2.$0"
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "copyAgent4": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "text"
      },
      "inputs": {
        "text": ":mapNode.copyAgent3"
      }
    }
  }
}

图表数据Bypass4

{
  "version": 0.5,
  "nodes": {
    "echo": {
      "agent": "echoAgent",
      "params": {
        "message": [
          "hello",
          "hello"
        ]
      }
    },
    "mapNode": {
      "agent": "mapAgent",
      "inputs": {
        "rows": ":echo.message"
      },
      "graph": {
        "version": 0.5,
        "nodes": {
          "copyAgent": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "row"
            },
            "inputs": {
              "row": ":row"
            }
          },
          "copyAgent2": {
            "agent": "copyAgent",
            "params": {
              "namedKey": "array"
            },
            "inputs": {
              "array": [
                ":copyAgent",
                ":row"
              ]
            },
            "isResult": true
          }
        }
      },
      "params": {
        "compositeResult": true
      }
    },
    "copyAgent3": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "text"
      },
      "inputs": {
        "text": ":mapNode.copyAgent2"
      }
    }
  }
}

图表数据Bypass5

{
  "version": 0.5,
  "nodes": {
    "echo": {
      "agent": "echoAgent",
      "params": {
        "message": "hello"
      }
    },
    "copyAgent": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "array"
      },
      "inputs": {
        "array": [
          ":echo",
          ":echo",
          ":echo"
        ]
      }
    },
    "copyAgent2": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "array"
      },
      "inputs": {
        "array": [
          ":copyAgent",
          ":copyAgent"
        ]
      }
    },
    "copyAgent3": {
      "agent": "copyAgent",
      "params": {
        "namedKey": "array"
      },
      "inputs": {
        "array": [
          ":copyAgent2",
          ":copyAgent2"
        ]
      }
    }
  }
}

版本与发布记录

@graphai/vanilla 共发布 75 个版本,首次发布于 2024/05/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.12latest2025/08/181.2 年前
2.0.112025/08/181.2 年前
2.0.102025/08/121.3 年前
2.0.92025/08/111.3 年前
2.0.82025/08/111.3 年前
2.0.72025/08/111.3 年前

关于 @graphai/vanilla 的常见问题

@graphai/vanilla 是什么?

GraphAI的香草剂.

如何安装 @graphai/vanilla?

在项目目录运行 npm install @graphai/vanilla,或使用 pnpm add / yarn add / bun add。

@graphai/vanilla 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@graphai/vanilla 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@graphai/vanilla 可以商用吗?

@graphai/vanilla 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@graphai/vanilla 的下载量有多少?

根据 npm 官方下载统计,@graphai/vanilla 在 2026/10/17 – 2026/11/15 这 30 天内被下载 16,599 次,日均约 553 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@graphai/vanilla 还在维护吗?

最新版本 2.0.12 发布于 2025/08/18(1.2 年前);至今共发布 75 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/05/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。