graphai 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +107 -78
  2. package/lib/experimental_agents/array_agents/packages.d.ts +4 -0
  3. package/lib/experimental_agents/array_agents/packages.js +12 -0
  4. package/lib/experimental_agents/array_agents/pop_agent.d.ts +26 -0
  5. package/lib/experimental_agents/array_agents/pop_agent.js +40 -0
  6. package/lib/experimental_agents/array_agents/push_agent.d.ts +16 -0
  7. package/lib/experimental_agents/array_agents/push_agent.js +18 -0
  8. package/lib/experimental_agents/array_agents/shift_agent.d.ts +26 -0
  9. package/lib/experimental_agents/array_agents/shift_agent.js +29 -0
  10. package/lib/experimental_agents/data_agents/data_object_merge_template_agent.d.ts +57 -2
  11. package/lib/experimental_agents/data_agents/data_object_merge_template_agent.js +13 -1
  12. package/lib/experimental_agents/data_agents/data_sum_template_agent.d.ts +1 -0
  13. package/lib/experimental_agents/data_agents/data_sum_template_agent.js +1 -0
  14. package/lib/experimental_agents/data_agents/packages.d.ts +4 -0
  15. package/lib/experimental_agents/data_agents/packages.js +12 -0
  16. package/lib/experimental_agents/data_agents/total_agent.d.ts +1 -0
  17. package/lib/experimental_agents/data_agents/total_agent.js +1 -0
  18. package/lib/experimental_agents/embedding_agent.d.ts +17 -3
  19. package/lib/experimental_agents/embedding_agent.js +13 -1
  20. package/lib/experimental_agents/graph_agents/index.d.ts +2 -0
  21. package/lib/experimental_agents/graph_agents/index.js +7 -0
  22. package/lib/experimental_agents/graph_agents/map_agent.d.ts +20 -0
  23. package/lib/experimental_agents/{map_agent.js → graph_agents/map_agent.js} +31 -10
  24. package/lib/experimental_agents/graph_agents/nested_agent.d.ts +22 -0
  25. package/lib/experimental_agents/graph_agents/nested_agent.js +70 -0
  26. package/lib/experimental_agents/graph_agents/packages.d.ts +3 -0
  27. package/lib/experimental_agents/graph_agents/packages.js +10 -0
  28. package/lib/experimental_agents/index.d.ts +4 -5
  29. package/lib/experimental_agents/index.js +4 -5
  30. package/lib/experimental_agents/matrix_agents/dot_product_agent.d.ts +17 -3
  31. package/lib/experimental_agents/matrix_agents/dot_product_agent.js +26 -1
  32. package/lib/experimental_agents/matrix_agents/packages.d.ts +3 -0
  33. package/lib/experimental_agents/matrix_agents/packages.js +10 -0
  34. package/lib/experimental_agents/matrix_agents/sort_by_values_agent.d.ts +17 -3
  35. package/lib/experimental_agents/matrix_agents/sort_by_values_agent.js +13 -1
  36. package/lib/experimental_agents/packages.d.ts +11 -0
  37. package/lib/experimental_agents/packages.js +33 -0
  38. package/lib/experimental_agents/slashgpt_agent.d.ts +24 -0
  39. package/lib/experimental_agents/slashgpt_agent.js +12 -0
  40. package/lib/experimental_agents/sleeper_agents/packages.d.ts +3 -0
  41. package/lib/experimental_agents/sleeper_agents/packages.js +10 -0
  42. package/lib/experimental_agents/sleeper_agents/sleeper_agent.d.ts +18 -0
  43. package/lib/experimental_agents/sleeper_agents/sleeper_agent.js +12 -0
  44. package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.d.ts +20 -0
  45. package/lib/experimental_agents/sleeper_agents/sleeper_agent_debug.js +13 -1
  46. package/lib/experimental_agents/string_agents/packages.d.ts +3 -0
  47. package/lib/experimental_agents/string_agents/packages.js +10 -0
  48. package/lib/experimental_agents/string_agents/string_splitter_agent.d.ts +1 -0
  49. package/lib/experimental_agents/string_agents/string_splitter_agent.js +1 -0
  50. package/lib/experimental_agents/string_agents/string_template_agent.d.ts +1 -0
  51. package/lib/experimental_agents/string_agents/string_template_agent.js +1 -0
  52. package/lib/experimental_agents/test_agents/bypass_agent.d.ts +3 -0
  53. package/lib/experimental_agents/test_agents/bypass_agent.js +24 -0
  54. package/lib/experimental_agents/test_agents/copy2array_agent.d.ts +6 -1
  55. package/lib/experimental_agents/test_agents/copy2array_agent.js +32 -2
  56. package/lib/experimental_agents/test_agents/copy_message_agent.d.ts +9 -1
  57. package/lib/experimental_agents/test_agents/copy_message_agent.js +19 -0
  58. package/lib/experimental_agents/test_agents/counting_agent.d.ts +8 -1
  59. package/lib/experimental_agents/test_agents/counting_agent.js +19 -0
  60. package/lib/experimental_agents/test_agents/echo_agent.d.ts +3 -0
  61. package/lib/experimental_agents/test_agents/echo_agent.js +13 -0
  62. package/lib/experimental_agents/test_agents/merge_node_id_agent.d.ts +3 -0
  63. package/lib/experimental_agents/test_agents/merge_node_id_agent.js +22 -0
  64. package/lib/experimental_agents/test_agents/packages.d.ts +7 -0
  65. package/lib/experimental_agents/test_agents/packages.js +18 -0
  66. package/lib/experimental_agents/token_agent.d.ts +20 -0
  67. package/lib/experimental_agents/token_agent.js +12 -0
  68. package/lib/graphai.d.ts +1 -1
  69. package/lib/graphai.js +8 -11
  70. package/lib/node.d.ts +1 -0
  71. package/lib/node.js +17 -10
  72. package/lib/type.d.ts +4 -3
  73. package/lib/utils/test_utils.js +1 -1
  74. package/lib/utils/utils.d.ts +3 -1
  75. package/lib/utils/utils.js +30 -2
  76. package/package.json +3 -2
  77. package/lib/experimental_agents/map_agent.d.ts +0 -4
  78. package/lib/experimental_agents/nested_agent.d.ts +0 -5
  79. package/lib/experimental_agents/nested_agent.js +0 -40
package/README.md CHANGED
@@ -2,13 +2,17 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- GraphAI is an asynchronous data flow execution engine, which makes it easy to build *agentic* applications, which perform the orchestration of mutiple "AI agents".
5
+ GraphAI is an asynchronous data flow execution engine, which allows developers to build *agentic applications* by describing *agent workflows* as declarative data flow graphs in YAML or JSON.
6
6
 
7
- *Agentic* applications need to make asynchronous API calls (such as OpenAI's chat-completion API, database query, web search, and etc.) multiple times and manage data dependencies among them, such as giving the answer from one LLM call to another LLM call as a prompt -- which will become quite difficult to manage in a traditional programing style as the complexity of the application increases, because of the asynchronous nature of those APIs.
7
+ As Andrew Ng has described in his article, "[The batch: Issue 242](https://www.deeplearning.ai/the-batch/issue-242/)", better results can often be achieved by making multiple calls to a Large Language Model (LLM) and allowing it to incrementally build towards a higher-quality output. Dr. Ng refers to this approach as 'agentic workflows.'
8
+
9
+ Such *agentic applications* need to make multiple asynchronous API calls (such as OpenAI's chat-completion API, database query, web search, and etc.) and manage data dependencies among them, such as giving the answer from one LLM call to another -- which will become quite difficult to manage in a traditional programing style as the complexity of the application increases, because of the asynchronous nature of those APIs.
8
10
 
9
- GraphAI allows developers to describe dependencies among those API calls in a single data flow graph (either in YAML or JSON), create a GraphAI instance with that graph, and let it run. The GraphAI engine will take care of all the complexity of concurrent asynchronous calls, data dependency management, error handling, retries and logging.
11
+ GraphAI allows developers to describe dependencies among those agents (asynchronous API calls) in a data flow graph in YAML or JSON, which is called *declarative data flow programming* . The GraphAI engine will take care of all the complexity of concurrent asynchronous calls, data dependency management, error handling, retries and logging.
10
12
 
11
- Here is an example graph, which uses the Wikipedia as the data source and perform an in-memory RAG.
13
+ ## Declarative Data Flow Programming
14
+
15
+ Here is a simple example, which uses the Wikipedia as the data source and perform an in-memory RAG (Retrieval-Augmented Generation).
12
16
 
13
17
  ```YAML
14
18
  nodes:
@@ -55,15 +59,22 @@ nodes:
55
59
  inputs: [prompt]
56
60
  ```
57
61
 
58
- ## Background
59
-
60
- As Andrew Ng has described in his article, "[The batch: Issue 242](https://www.deeplearning.ai/the-batch/issue-242/)", better results can often be achieved by making multiple calls to a Large Language Model (LLM) and allowing it to incrementally build towards a higher-quality output. Dr. Ng refers to this approach as 'agentic workflows.'
61
-
62
- Building applications that employ these workflows, however, is challenging due to the complexities of managing multiple asynchronous API calls, including error handling, timeouts, retries, and logging.
63
-
64
- GraphAI is designed to simplify this process by decoupling the complexity of multiple asynchronous calls from the application's core logic. It enables developers to model these calls and their dependencies within a single acyclic Data Flow Graph, enhancing development and debugging processes.
62
+ ```mermaid
63
+ flowchart TD
64
+ source(source) -- name --> wikipedia
65
+ source -- query --> topicEmbedding
66
+ wikipedia --> chunks
67
+ chunks --> chunksEmbeddings
68
+ chunksEmbeddings --> similarities
69
+ topicEmbedding --> similarities
70
+ similarities --> sortedChunks
71
+ sortedChunks --> resourceText
72
+ source -- query --> prompt
73
+ resourceText --> prompt
74
+ prompt --> query
75
+ ```
65
76
 
66
- Furthermore, GraphAI's robust mechanisms for error handling, retry strategies, timeouts, and logging empower developers to concentrate on refining the application logic.
77
+ Notice that the conversion of the querty text into an embedding vector and text chunks into an array of embedding vectors can be done concurrently because there is no dependency between them. GraphAI will automatically recognize it and execute them concurrently. This kind of *concurrent programing* is very difficult in traditional programming style, and GraphAI's *data flow programming* style is much better alternative.
67
78
 
68
79
  ## Quick Install
69
80
 
@@ -77,75 +88,71 @@ or
77
88
  yarn add graphai
78
89
  ```
79
90
 
80
- ## Collaboration
91
+ ## Data Flow Graph
81
92
 
82
- Step 1. Install git, node and yarn
93
+ A Data Flow Graph (DFG) is a JavaScript object, which defines the flow of data. It is typically described in YAML file and loaded at runtime.
83
94
 
84
- Step 2. Clone the project and install necessary node modules
95
+ A DFG consists of a collection of [nodes](#node), which contains a series of nested properties representing individual nodes in the data flow. Each node is identified by a unique key, *nodeId* (e.g., node1, node2) and can contain several predefined properties (such as params, inputs, and value) that dictate the node's behavior and its relationship with other nodes. There are two types of nodes, [computed nodes](#computed-node) and [static nodes](#static-node), which are described below.
85
96
 
86
- ```
87
- git clone git@github.com:snakajima/graphai.git
88
- cd graphai
89
- yarn install
90
- ```
97
+ Connections between nodes will be established by references from one not to another, using either its "inputs" or "update" property. The values of those properties are *data sources*. A *data souce* is specified by either the nodeId (e.g., "node1"), or nodeId + propertyId ("node1.item").
91
98
 
92
- Step 3. Set the environment variable OPENAI_API_KEY to your own key (=sk-...)
99
+ ### DFG Structure
93
100
 
94
- You need to set ANTHROPIC_API_KEY as well, if you want to use Claude.
101
+ - 'nodes': A list of node. Required.
102
+ - 'concurrency': An optional property, which specifies the maximum number of concurrent operations (agent functions to be executed at the same time). The default is 8.
103
+ - 'loop': An optional property, which specifies if the graph needs to be executed multiple times. See the [Loop section below](#loop) for details.
95
104
 
96
- Step 4. Run the test script
105
+ ## Agent
97
106
 
98
- Start web server for http agent
107
+ An *agent* is an abstract object which takes some inputs and generates an output asynchronously. It could be an LLM (such as GPT-4), a media generator, a database, or a REST API over HTTP. A node associated with an agent (specified by 'agentId' property) is called [computed node](#computed-node), which takes a set of inputs from other nodes, lets the agent to process it, and pushes the returned value to other nodes.
99
108
 
100
- ```
101
- cd tests/http-server/docs/
102
- npx http-server
103
- ```
109
+ ### Agent function
104
110
 
105
- then run the test
111
+ An agent function is a TypeScript function, which implements a particular *agent*. An *agent function* receives two set of parameters via AgentFunctionContext:
106
112
 
107
- ```
108
- npm run test
109
- ```
113
+ - params: agent specific parameters specified in the DFG (specified by the "params" property of the node)
114
+ - inputs: a set of inputs came from other nodes (specified by "inputs" property of the node).
110
115
 
111
- Step 5. Run one of sample scripts
116
+ ## Node
112
117
 
113
- ```
114
- npm run sample ./samples/home.ts
115
- ```
118
+ There are two types of Node, *computed nodes* and *static nodes*. A *computed node* is associated with an *agent function*, which receives some inputs, performs some computations asynchronously then returns the result (output). A *static node* is a placeholder of a value (just like a variable in programming language), which is specified by the *value* property, injected by an external program, or is updated at the end of iteration (see the [loop](#loop)).
116
119
 
117
- Step 6. Write some code and send pull requests
120
+ ### Computed Node
118
121
 
119
- Key principles:
122
+ A *computed node* have following properties.
120
123
 
121
- 1. Keep the core (Node and GraphAI classes) small and simple.
122
- 2. Enhance the platform by adding 'agents' (plug ins).
123
- 3. Simple but effective test scripts make it easy to maintain.
124
- 4. Run "npm run format" before submitting pull requests.
124
+ - 'agentId': An **required** property, which specifies the id of the *agent function*.
125
+ - 'params': An optional agent-specific property to control the behavior of the associated agent function.
126
+ - 'inputs': An optional list of *data sources* that the current node receives the data from. This establishes a data flow where the current node can only be executed after the completion of the nodes listed under 'inputs'. If this list is empty, the associated *agent function* will be immediatley executed.
127
+ - 'anyInput': An optiona boolean flag, which indicates that the associated *agent function* will be called when at least one of input data became available. Otherwise, it will wait until all the data became available.
128
+ - 'retry': An optional number, which specifies the maximum number of retries to be made. If the last attempt fails, the error will be recorded.
129
+ - 'timeout': An optional number, which specifies the maximum waittime in msec. If the associated agent function does not return the value in time, the "Timeout" error will be recorded. The returned value received after the time out will be discarded.
125
130
 
126
- ## Data Flow Graph
131
+ ### Static Node
127
132
 
128
- A Data Flow Graph (DFG) is a JavaScript object, which defines the flow of data. It is typically described in YAML file and loaded at runtime.
133
+ A *static* node have following properties.
129
134
 
130
- A DFG consists of a collection of 'nodes', which contains a series of nested properties representing individual nodes in the data flow. Each node is identified by a unique key, *nodeId* (e.g., node1, node2) and can contain several predefined properties (params, inputs, anyInput, retry, timeout, agentId, fork, value, update) that dictate the node's behavior and its relationship with other nodes.
135
+ - 'value': An **required** property, which specifies the initial value of this static node (equivalent to calling the injectValue method from outside).
136
+ - 'update': An optional property, which specifies the *data source* after each iteration. See the [loop](#loop) for details.
131
137
 
132
- Connections between nodes will be established by references from one not to another, using either its "inputs" or "update" property. The values of those properties are *data sources*. A *data souce* is specified by either the nodeId (e.g., "node1"), or nodeId + propertyId ("node1.item").
138
+ ## Flow Control
133
139
 
134
- ### DFG Structure
140
+ Since the data-flow graph must be asyclic by design, we added a few mechanism to control data flows, [loop](#loop), [nesting](#nesting), [mapping](#mapping) and [condtional flow](#conditional-flow).
135
141
 
136
- - 'nodes': A list of node. Required.
137
- - 'concurrency': An optional property, which specifies the maximum number of concurrent operations (agent functions to be executed at the same time). The default is 8.
138
- - 'loop': An optional property, which specifies if the graph needs to be executed multiple times. The loop is an JavaScript object, which has two optinoal properties. The *count* property specifies the number of times the graph needs to be executed and the *while* property specifies the condition required to contineu the loop in the form of node name (nodeId) or its property (nodeId.propId). Unlike JavaScript, an empty array will be treated as false.
142
+ ### Loop
143
+
144
+ The loop is an optioal property of a graph, which has two optional properties. The *count* property specifies the number of times the graph needs to be executed and the *while* property specifies the condition required to contineu the loop in the form of node name (nodeId) or its property (nodeId.propId). Unlike JavaScript, an empty array will be treated as false.
145
+
146
+ Here is an example, which performs an LLM query for each person in the list and create the list of answers. The "people" node (static), is initialized with an array of names, and the "retriever" node (computed) retrieves one name at a time, and send it to the "query" node (computed) to perform an LLM query. The "reducer" append it the array retrieved form the "result" node (static node, which is initialized as an empty array).
147
+
148
+ The "update" property of two static nodes ("people" and "result"), updates those properties based on the results from the previous itelation. This loop continues until the value of "people" node become an empty array.
139
149
 
140
150
  ```
141
151
  loop:
142
152
  while: people
143
153
  nodes:
144
154
  people:
145
- value:
146
- - Steve Jobs
147
- - Elon Musk
148
- - Nikola Tesla
155
+ value: [Steve Jobs, Elon Musk, Nikola Tesla]
149
156
  update: retriever.array
150
157
  result:
151
158
  value: []
@@ -157,41 +164,24 @@ nodes:
157
164
  agentId: slashgpt
158
165
  params:
159
166
  manifest:
160
- prompt: 指定した人について日本語で400字以内で答えて
167
+ prompt: Describe about the person in less than 100 words
161
168
  inputs: [retriever.item]
162
169
  reducer:
163
170
  agentId: push
164
171
  inputs: [result, query.content]
165
172
  ```
166
173
 
167
- ## Agent
168
-
169
- An agent is an abstract object, which takes some inputs and generates an output asynchronously. It could be an LLM (such as GPT-4), an image/video/music generator, a database, or a REST API over HTTP. Each node (except 'source node') is associated with an agent function, which takes data flow into the node as inputs, and generates an output.
170
-
171
- ## Agent function
172
-
173
- An agent function is a TypeScript function, which implements an agent. A DFG is associated one or more agent functions. If the DFG is associated with multiple agent functions, each node needs to be associated only one of them (either explicitly with 'agentId' or implicitly to the default Agent function).
174
+ ### Nesting
174
175
 
175
- An agent function receives two set of parameters via AgentFunctionContext, agent specific parameters specified in the DFG and input data came from other nodes.
176
+ To be filled.
176
177
 
177
- ## Node Structure
178
+ ### Mapping
178
179
 
179
- There are two types of Node, *computed nodes* and *static nodes*. A *computed node* is associated with an *agent function*, which receives some inputs, performs some computations asynchronously then returns the result (output). A *static node* is a placeholder of a value (just like a variable in programming language), which is injected by an external program, or is retrived from a *data source* (in case of interations).
180
+ To be filled.
180
181
 
181
- A *computed node* have following properties.
182
-
183
- - 'agentId': An **required** property, which specifies the id of the *agent function*.
184
- - 'inputs': An optional list of *data sources* that the current node depends on. This establishes a flow where the current node can only be executed after the completion of the nodes listed under 'inputs'. If this list is empty, the associated *agent function* will be immediatley executed.
185
- - 'anyInput': An optiona boolean flag, which indicates that the associated *agent function* will be called when at least one of input data became available. Otherwise, it will wait until all the data became available.
186
- - 'retry': An optional number, which specifies the maximum number of retries to be made. If the last attempt fails, that return value will be recorded.
187
- - 'timeout': An optional number, which specifies the maximum waittime in msec. If the associated agent function does not return the value in time, the "Timeout" error will be recorded and the returned value will be discarded.
188
- - 'params': An optional property to the associated agent function, which are agent specific.
189
- - 'fork': An optional paramter, which specifies the number of concurrent transactions to be created for the current node.
190
-
191
- A *static* node have following properties.
182
+ ### Conditional Flow
192
183
 
193
- - 'value': An **required** property, which specifies the initial value of this static node (equivalent to calling the injectValue method from outside).
194
- - 'update': An optional property, which specifies the *data source* after each iteration.
184
+ To be filled.
195
185
 
196
186
  ## GraphAI class
197
187
 
@@ -226,3 +216,42 @@ Injects a result into a specified node. This is used to manually set the result
226
216
 
227
217
  - ```nodeId: string```: The ID of the static node into which the result is to be injected.
228
218
  - ```result: ResultData```: The result to be injected into the specified node.
219
+
220
+ ## Collaboration
221
+
222
+ Step 1. Install git, node and yarn
223
+
224
+ Step 2. Clone the project and install necessary node modules
225
+
226
+ ```
227
+ git clone git@github.com:snakajima/graphai.git
228
+ cd graphai
229
+ yarn install
230
+ ```
231
+
232
+ Step 3. Set the environment variable OPENAI_API_KEY to your own key (=sk-...)
233
+
234
+ You need to set ANTHROPIC_API_KEY as well, if you want to use Claude.
235
+
236
+ Step 4. Run the test script
237
+
238
+ Run the test
239
+
240
+ ```
241
+ npm run test
242
+ ```
243
+
244
+ Step 5. Run one of sample scripts
245
+
246
+ ```
247
+ npm run sample ./samples/home.ts
248
+ ```
249
+
250
+ Step 6. Write some code and send pull requests
251
+
252
+ Key principles:
253
+
254
+ 1. Keep the core (Node and GraphAI classes) small and simple.
255
+ 2. Enhance the platform by adding 'agents' (plug ins).
256
+ 3. Simple but effective test scripts make it easy to maintain.
257
+ 4. Run "npm run format" before submitting pull requests.
@@ -0,0 +1,4 @@
1
+ import pushAgent from "../../experimental_agents/array_agents/push_agent";
2
+ import popAgent from "../../experimental_agents/array_agents/pop_agent";
3
+ import shiftAgent from "../../experimental_agents/array_agents/shift_agent";
4
+ export { pushAgent, popAgent, shiftAgent };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.shiftAgent = exports.popAgent = exports.pushAgent = void 0;
7
+ const push_agent_1 = __importDefault(require("../../experimental_agents/array_agents/push_agent"));
8
+ exports.pushAgent = push_agent_1.default;
9
+ const pop_agent_1 = __importDefault(require("../../experimental_agents/array_agents/pop_agent"));
10
+ exports.popAgent = pop_agent_1.default;
11
+ const shift_agent_1 = __importDefault(require("../../experimental_agents/array_agents/shift_agent"));
12
+ exports.shiftAgent = shift_agent_1.default;
@@ -1,2 +1,28 @@
1
1
  import { AgentFunction } from "../../graphai";
2
2
  export declare const popAgent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
3
+ declare const popAgentInfo: {
4
+ name: string;
5
+ agent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
6
+ mock: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
7
+ samples: ({
8
+ inputs: string[][];
9
+ params: {};
10
+ result: {
11
+ array: string[];
12
+ item: string;
13
+ };
14
+ } | {
15
+ inputs: (string[] | number[])[];
16
+ params: {};
17
+ result: {
18
+ array: number[];
19
+ item: number;
20
+ };
21
+ })[];
22
+ description: string;
23
+ category: string[];
24
+ author: string;
25
+ repository: string;
26
+ license: string;
27
+ };
28
+ export default popAgentInfo;
@@ -13,3 +13,43 @@ const popAgent = async (context) => {
13
13
  return { array, item };
14
14
  };
15
15
  exports.popAgent = popAgent;
16
+ const popAgentInfo = {
17
+ name: "popAgent",
18
+ agent: exports.popAgent,
19
+ mock: exports.popAgent,
20
+ samples: [
21
+ {
22
+ inputs: [[1, 2, 3]],
23
+ params: {},
24
+ result: {
25
+ array: [1, 2],
26
+ item: 3,
27
+ },
28
+ },
29
+ {
30
+ inputs: [["a", "b", "c"]],
31
+ params: {},
32
+ result: {
33
+ array: ["a", "b"],
34
+ item: "c",
35
+ },
36
+ },
37
+ {
38
+ inputs: [
39
+ [1, 2, 3],
40
+ ["a", "b", "c"],
41
+ ],
42
+ params: {},
43
+ result: {
44
+ array: [1, 2],
45
+ item: 3,
46
+ },
47
+ },
48
+ ],
49
+ description: "Pop Agent",
50
+ category: ["array"],
51
+ author: "Receptron team",
52
+ repository: "https://github.com/receptron/graphai",
53
+ license: "MIT",
54
+ };
55
+ exports.default = popAgentInfo;
@@ -1,2 +1,18 @@
1
1
  import { AgentFunction } from "../../graphai";
2
2
  export declare const pushAgent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
3
+ declare const pushAgentInfo: {
4
+ name: string;
5
+ agent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
6
+ mock: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
7
+ samples: {
8
+ inputs: (number | number[])[];
9
+ params: {};
10
+ result: number[];
11
+ }[];
12
+ description: string;
13
+ category: never[];
14
+ author: string;
15
+ repository: string;
16
+ license: string;
17
+ };
18
+ export default pushAgentInfo;
@@ -12,3 +12,21 @@ const pushAgent = async ({ inputs }) => {
12
12
  return array;
13
13
  };
14
14
  exports.pushAgent = pushAgent;
15
+ const pushAgentInfo = {
16
+ name: "pushAgent",
17
+ agent: exports.pushAgent,
18
+ mock: exports.pushAgent,
19
+ samples: [
20
+ {
21
+ inputs: [[1, 2], 3],
22
+ params: {},
23
+ result: [1, 2, 3],
24
+ },
25
+ ],
26
+ description: "push Agent",
27
+ category: [],
28
+ author: "Receptron team",
29
+ repository: "https://github.com/receptron/graphai",
30
+ license: "MIT",
31
+ };
32
+ exports.default = pushAgentInfo;
@@ -1,2 +1,28 @@
1
1
  import { AgentFunction } from "../../graphai";
2
2
  export declare const shiftAgent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
3
+ declare const shiftAgentInfo: {
4
+ name: string;
5
+ agent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
6
+ mock: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
7
+ samples: ({
8
+ inputs: number[][];
9
+ params: {};
10
+ result: {
11
+ array: number[];
12
+ item: number;
13
+ };
14
+ } | {
15
+ inputs: string[][];
16
+ params: {};
17
+ result: {
18
+ array: string[];
19
+ item: string;
20
+ };
21
+ })[];
22
+ description: string;
23
+ category: never[];
24
+ author: string;
25
+ repository: string;
26
+ license: string;
27
+ };
28
+ export default shiftAgentInfo;
@@ -13,3 +13,32 @@ const shiftAgent = async (context) => {
13
13
  return { array, item };
14
14
  };
15
15
  exports.shiftAgent = shiftAgent;
16
+ const shiftAgentInfo = {
17
+ name: "shiftAgent",
18
+ agent: exports.shiftAgent,
19
+ mock: exports.shiftAgent,
20
+ samples: [
21
+ {
22
+ inputs: [[1, 2, 3]],
23
+ params: {},
24
+ result: {
25
+ array: [2, 3],
26
+ item: 1,
27
+ },
28
+ },
29
+ {
30
+ inputs: [["a", "b", "c"]],
31
+ params: {},
32
+ result: {
33
+ array: ["b", "c"],
34
+ item: "a",
35
+ },
36
+ },
37
+ ],
38
+ description: "shift Agent",
39
+ category: [],
40
+ author: "Receptron team",
41
+ repository: "https://github.com/receptron/graphai",
42
+ license: "MIT",
43
+ };
44
+ exports.default = shiftAgentInfo;
@@ -4,7 +4,7 @@ declare const dataObjectMergeTemplateAgentInfo: {
4
4
  name: string;
5
5
  agent: AgentFunction;
6
6
  mock: AgentFunction;
7
- samples: {
7
+ samples: ({
8
8
  inputs: ({
9
9
  a: number;
10
10
  b: number;
@@ -18,9 +18,64 @@ declare const dataObjectMergeTemplateAgentInfo: {
18
18
  result: {
19
19
  a: number;
20
20
  b: number;
21
+ c: number;
22
+ };
23
+ } | {
24
+ inputs: ({
25
+ a: {
26
+ b: {
27
+ c: {
28
+ d: string;
29
+ };
30
+ };
31
+ };
32
+ b?: undefined;
33
+ } | {
34
+ b: {
35
+ c: {
36
+ d: {
37
+ e: string;
38
+ };
39
+ };
40
+ d?: undefined;
41
+ };
42
+ a?: undefined;
43
+ } | {
44
+ b: {
45
+ d: {
46
+ e: {
47
+ f: string;
48
+ };
49
+ };
50
+ c?: undefined;
51
+ };
52
+ a?: undefined;
53
+ })[];
54
+ params: {};
55
+ result: {
56
+ a: {
57
+ b: {
58
+ c: {
59
+ d: string;
60
+ };
61
+ };
62
+ };
63
+ b: {
64
+ c: {
65
+ d: {
66
+ e: string;
67
+ };
68
+ };
69
+ d: {
70
+ e: {
71
+ f: string;
72
+ };
73
+ };
74
+ };
21
75
  };
22
- }[];
76
+ })[];
23
77
  description: string;
78
+ category: never[];
24
79
  author: string;
25
80
  repository: string;
26
81
  license: string;
@@ -18,7 +18,7 @@ const sampleInputs = [
18
18
  { a: 3, b: 0, c: 5 },
19
19
  ];
20
20
  const sampleParams = {};
21
- const sampleResult = { a: 6, b: 3 };
21
+ const sampleResult = { a: 3, b: 0, c: 5 };
22
22
  const dataObjectMergeTemplateAgentInfo = {
23
23
  name: "dataObjectMergeTemplateAgent",
24
24
  agent: exports.dataObjectMergeTemplateAgent,
@@ -29,8 +29,20 @@ const dataObjectMergeTemplateAgentInfo = {
29
29
  params: sampleParams,
30
30
  result: sampleResult,
31
31
  },
32
+ {
33
+ inputs: [{ a: { b: { c: { d: "e" } } } }, { b: { c: { d: { e: "f" } } } }, { b: { d: { e: { f: "g" } } } }],
34
+ params: {},
35
+ result: {
36
+ a: { b: { c: { d: "e" } } },
37
+ b: {
38
+ c: { d: { e: "f" } },
39
+ d: { e: { f: "g" } },
40
+ },
41
+ },
42
+ },
32
43
  ],
33
44
  description: "Merge object",
45
+ category: [],
34
46
  author: "Satoshi Nakajima",
35
47
  repository: "https://github.com/receptron/graphai",
36
48
  license: "MIT",
@@ -10,6 +10,7 @@ declare const dataSumTemplateAgentInfo: {
10
10
  result: number;
11
11
  }[];
12
12
  description: string;
13
+ category: never[];
13
14
  author: string;
14
15
  repository: string;
15
16
  license: string;
@@ -23,6 +23,7 @@ const dataSumTemplateAgentInfo = {
23
23
  },
24
24
  ],
25
25
  description: "Returns the sum of input values",
26
+ category: [],
26
27
  author: "Satoshi Nakajima",
27
28
  repository: "https://github.com/receptron/graphai",
28
29
  license: "MIT",
@@ -0,0 +1,4 @@
1
+ import totalAgent from "../../experimental_agents/data_agents/total_agent";
2
+ import dataObjectMergeTemplateAgent from "../../experimental_agents/data_agents/data_object_merge_template_agent";
3
+ import dataSumTemplateAgent from "../../experimental_agents/data_agents/data_sum_template_agent";
4
+ export { totalAgent, dataObjectMergeTemplateAgent, dataSumTemplateAgent };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.dataSumTemplateAgent = exports.dataObjectMergeTemplateAgent = exports.totalAgent = void 0;
7
+ const total_agent_1 = __importDefault(require("../../experimental_agents/data_agents/total_agent"));
8
+ exports.totalAgent = total_agent_1.default;
9
+ const data_object_merge_template_agent_1 = __importDefault(require("../../experimental_agents/data_agents/data_object_merge_template_agent"));
10
+ exports.dataObjectMergeTemplateAgent = data_object_merge_template_agent_1.default;
11
+ const data_sum_template_agent_1 = __importDefault(require("../../experimental_agents/data_agents/data_sum_template_agent"));
12
+ exports.dataSumTemplateAgent = data_sum_template_agent_1.default;
@@ -39,6 +39,7 @@ declare const totalAgentInfo: {
39
39
  };
40
40
  })[];
41
41
  description: string;
42
+ category: never[];
42
43
  author: string;
43
44
  repository: string;
44
45
  license: string;
@@ -44,6 +44,7 @@ const totalAgentInfo = {
44
44
  },
45
45
  ],
46
46
  description: "Returns the sum of input values",
47
+ category: [],
47
48
  author: "Satoshi Nakajima",
48
49
  repository: "https://github.com/snakajima/graphai",
49
50
  license: "MIT",
@@ -1,6 +1,20 @@
1
1
  import { AgentFunction } from "../graphai";
2
2
  export declare const stringEmbeddingsAgent: AgentFunction<{
3
3
  model?: string;
4
- }, {
5
- contents: any;
6
- }, Array<string> | string>;
4
+ }, any, Array<string> | string>;
5
+ declare const stringEmbeddingsAgentInfo: {
6
+ name: string;
7
+ agent: AgentFunction<{
8
+ model?: string | undefined;
9
+ }, any, string | string[]>;
10
+ mock: AgentFunction<{
11
+ model?: string | undefined;
12
+ }, any, string | string[]>;
13
+ samples: never[];
14
+ description: string;
15
+ category: never[];
16
+ author: string;
17
+ repository: string;
18
+ license: string;
19
+ };
20
+ export default stringEmbeddingsAgentInfo;