graphai 0.2.5 → 0.2.6
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.
- package/README.md +133 -19
- package/lib/experimental_agents/data_agents/copy_agent.d.ts +26 -0
- package/lib/experimental_agents/data_agents/copy_agent.js +29 -0
- package/lib/experimental_agents/data_agents/index.d.ts +1 -0
- package/lib/experimental_agents/data_agents/index.js +3 -1
- package/lib/experimental_agents/data_agents/property_filter_agent.js +9 -3
- package/lib/experimental_agents/graph_agents/map_agent.d.ts +3 -0
- package/lib/experimental_agents/graph_agents/map_agent.js +5 -2
- package/lib/experimental_agents/graph_agents/nested_agent.js +1 -1
- package/lib/experimental_agents/index.d.ts +1 -0
- package/lib/experimental_agents/index.js +1 -0
- package/lib/experimental_agents/llm_agents/groq_agent.js +0 -1
- package/lib/experimental_agents/service_agents/index.d.ts +2 -0
- package/lib/experimental_agents/service_agents/index.js +7 -0
- package/lib/experimental_agents/service_agents/rss_agent.d.ts +13 -0
- package/lib/experimental_agents/service_agents/rss_agent.js +29 -0
- package/lib/experimental_agents/service_agents/wikipedia.d.ts +22 -0
- package/lib/experimental_agents/service_agents/wikipedia.js +38 -0
- package/lib/experimental_agents/test_agents/index.d.ts +1 -0
- package/lib/experimental_agents/test_agents/index.js +3 -1
- package/lib/experimental_agents/test_agents/packages.d.ts +2 -1
- package/lib/experimental_agents/test_agents/packages.js +3 -1
- package/lib/experimental_agents/test_agents/stream_mock_agent.d.ts +5 -0
- package/lib/experimental_agents/test_agents/stream_mock_agent.js +28 -0
- package/lib/graphai.d.ts +6 -2
- package/lib/graphai.js +3 -2
- package/lib/node.d.ts +3 -1
- package/lib/node.js +29 -1
- package/lib/type.d.ts +8 -1
- package/lib/utils/test_agents.js +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ As Andrew Ng has described in his article, "[The batch: Issue 242](https://www.d
|
|
|
8
8
|
|
|
9
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.
|
|
10
10
|
|
|
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.
|
|
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, task priority management, map-reduce processing, error handling, retries and logging.
|
|
12
12
|
|
|
13
13
|
## Declarative Data Flow Programming
|
|
14
14
|
|
|
@@ -20,10 +20,10 @@ nodes:
|
|
|
20
20
|
value:
|
|
21
21
|
name: Sam Bankman-Fried
|
|
22
22
|
query: describe the final sentence by the court for Sam Bank-Fried
|
|
23
|
-
wikipedia: // Retrieve data from Wikipedia
|
|
23
|
+
wikipedia: // Retrieve data from Wikipedia
|
|
24
24
|
agentId: wikipediaAgent
|
|
25
25
|
inputs: [source.name]
|
|
26
|
-
chunks: // Break the text from Wikipedia into chunks(2048 character each with 512 overlap)
|
|
26
|
+
chunks: // Break the text from Wikipedia into chunks (2048 character each with 512 overlap)
|
|
27
27
|
agentId: stringSplitterAgent
|
|
28
28
|
inputs: [wikipedia]
|
|
29
29
|
chunkEmbeddings: // Get embedding vector of each chunk
|
|
@@ -35,7 +35,7 @@ nodes:
|
|
|
35
35
|
similarities: // Calculate the cosine similarity of each chunk
|
|
36
36
|
agentId: dotProductAgent
|
|
37
37
|
inputs: [chunkEmbeddings, topicEmbedding]
|
|
38
|
-
sortedChunks: // Sort chunks based on
|
|
38
|
+
sortedChunks: // Sort chunks based on their similarities
|
|
39
39
|
agentId: sortByValuesAgent
|
|
40
40
|
inputs: [chunks, similarities]
|
|
41
41
|
referenceText: // Concatenate chunks up to the token limit (5000)
|
|
@@ -61,17 +61,17 @@ nodes:
|
|
|
61
61
|
|
|
62
62
|
```mermaid
|
|
63
63
|
flowchart TD
|
|
64
|
-
source
|
|
65
|
-
source -- query --> topicEmbedding
|
|
66
|
-
wikipedia --> chunks
|
|
67
|
-
chunks --> chunksEmbeddings
|
|
68
|
-
chunksEmbeddings --> similarities
|
|
64
|
+
source -- name --> wikipedia(wikipedia)
|
|
65
|
+
source -- query --> topicEmbedding(topicEmbedding)
|
|
66
|
+
wikipedia --> chunks(chunks)
|
|
67
|
+
chunks --> chunksEmbeddings(chunksEmbeddings)
|
|
68
|
+
chunksEmbeddings --> similarities(similarities)
|
|
69
69
|
topicEmbedding --> similarities
|
|
70
|
-
similarities --> sortedChunks
|
|
71
|
-
sortedChunks --> resourceText
|
|
72
|
-
source -- query --> prompt
|
|
70
|
+
similarities --> sortedChunks(sortedChunks)
|
|
71
|
+
sortedChunks --> resourceText(resourceText)
|
|
72
|
+
source -- query --> prompt(prompt)
|
|
73
73
|
resourceText --> prompt
|
|
74
|
-
prompt --> query
|
|
74
|
+
prompt --> query(query)
|
|
75
75
|
```
|
|
76
76
|
|
|
77
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.
|
|
@@ -126,7 +126,9 @@ A *computed node* have following properties.
|
|
|
126
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
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
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.
|
|
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.
|
|
130
|
+
- 'isResult': An optional boolean value, which indicates that the return value of this node, should be included as a property of the return value from the run() method of the GraphUI instance.
|
|
131
|
+
- 'priority': An optional number, which specifies the priority of the execution of the associated agent (the task). Default is 0, which means "neutral". Negative numbers are allowed as well.
|
|
130
132
|
|
|
131
133
|
### Static Node
|
|
132
134
|
|
|
@@ -137,7 +139,62 @@ A *static* node have following properties.
|
|
|
137
139
|
|
|
138
140
|
## Flow Control
|
|
139
141
|
|
|
140
|
-
Since the data-flow graph must be asyclic by design, we added a few mechanism to control data flows, [
|
|
142
|
+
Since the data-flow graph must be asyclic by design, we added a few mechanism to control data flows, [nesting](#nesting), [loop](#loop), [mapping](#mapping) and [condtional flow](#conditional-flow).
|
|
143
|
+
|
|
144
|
+
### Nested Graph
|
|
145
|
+
|
|
146
|
+
In order to make it easy to reuse some code, GraphAI supports nesting. It requires a special agent function, which creates an instance (or instances) of GraphAI object within the agent function and execute it. The system supports two types of nesting agent functions (nestAgent and mapAgent), but developers can create their own using the standard agent extension mechanism.
|
|
147
|
+
|
|
148
|
+
A typical nesting graph looks like this:
|
|
149
|
+
|
|
150
|
+
```YAML
|
|
151
|
+
nodes:
|
|
152
|
+
question:
|
|
153
|
+
value: "Find out which materials we need to purchase this week for Joe Smith's residential house project."
|
|
154
|
+
projectId: // identifies the projectId from the question
|
|
155
|
+
agentId: "identifierAgent"
|
|
156
|
+
inputs: ["source"] // == "sourceNode.query"
|
|
157
|
+
database:
|
|
158
|
+
agentId: "nestedAgent"
|
|
159
|
+
inputs: ["question", "projectId"]
|
|
160
|
+
graph:
|
|
161
|
+
nodes:
|
|
162
|
+
schema: // retrieves the database schema for the apecified projectId
|
|
163
|
+
agentId: "schemaAgent"
|
|
164
|
+
inputs: ["$1"]
|
|
165
|
+
... // issue query to the database and build an appropriate prompt with it.
|
|
166
|
+
query: // send the generated prompt to the LLM
|
|
167
|
+
agentId: "llama3Agent"
|
|
168
|
+
inputs: ["prompt"]
|
|
169
|
+
isResult: true
|
|
170
|
+
response: // Deliver the answer
|
|
171
|
+
agentid: "deliveryAgent"
|
|
172
|
+
inputs: [database.query.$last.content]
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The databaseQuery node (which is associated "nestedAgent") takes the data from "question" node abd "projectId" node, and make them available to inner nodes (nodes of the child graph) via phantom node, "$0" and "$1". After the completion of the child graph, the data from "query" node (which has "isResult" property) becomes available as a property of the output of "database" node.
|
|
176
|
+
|
|
177
|
+
Here is the diagram of the parent graph.
|
|
178
|
+
|
|
179
|
+
```mermaid
|
|
180
|
+
flowchart LR
|
|
181
|
+
question --> projectId(projectId)
|
|
182
|
+
question --> database
|
|
183
|
+
projectId --> database
|
|
184
|
+
database[[database]] -- query --> response(responce)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Here is the diagram of the child graph. Notice that two phantom nodes are automatically created to allow inner nodes to access input data from the parent graph.
|
|
188
|
+
|
|
189
|
+
```mermaid
|
|
190
|
+
flowchart LR
|
|
191
|
+
$0 --> ...
|
|
192
|
+
$1 --> schema(schema)
|
|
193
|
+
schema --> ...(...)
|
|
194
|
+
... --> query(query)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This mechanism does not only allows devleoper to reuse code, but also makes it possible to execute the child graph on another machine using a "remote" agent (which will be released later), enabling the *distributed execution* of nested graphs.
|
|
141
198
|
|
|
142
199
|
### Loop
|
|
143
200
|
|
|
@@ -157,6 +214,7 @@ nodes:
|
|
|
157
214
|
result:
|
|
158
215
|
value: []
|
|
159
216
|
update: reducer
|
|
217
|
+
isResult: true
|
|
160
218
|
retriever:
|
|
161
219
|
agentId: shift
|
|
162
220
|
inputs: [people]
|
|
@@ -171,22 +229,78 @@ nodes:
|
|
|
171
229
|
inputs: [result, query.content]
|
|
172
230
|
```
|
|
173
231
|
|
|
174
|
-
|
|
232
|
+
```mermaid
|
|
233
|
+
flowchart LR
|
|
234
|
+
result --> reducer(reducer)
|
|
235
|
+
people --> retriever(retriever)
|
|
236
|
+
retriever -- item --> query(query)
|
|
237
|
+
query -- content --> reducer
|
|
238
|
+
retriever -. array .-> people
|
|
239
|
+
reducer -.-> result
|
|
240
|
+
```
|
|
175
241
|
|
|
176
|
-
|
|
242
|
+
The *loop* mechanism is often used with a nested graph, which receives an array of data from a node of the parent graph and performs the "reduction" process of a *map-reduce* operation, just like the *reduce* method of JavaScript.
|
|
243
|
+
|
|
244
|
+
Please notice that each iteration will be done sequencially unlike the *mapping* described below.
|
|
177
245
|
|
|
178
246
|
### Mapping
|
|
179
247
|
|
|
180
|
-
|
|
248
|
+
The mapAgent is one of nested agents, which receives an array of data as an input (inputs[0]) and performs the same operation (specified by its graph property) on each item concurrently.
|
|
249
|
+
|
|
250
|
+
If the size of array is N, the mapAgent creates N instances of GraphAI object, and run them concurrently.
|
|
251
|
+
|
|
252
|
+
After the completion of all of instances, the mapAgent returns an array of results, just like the map function of JavaScript.
|
|
253
|
+
|
|
254
|
+
The following graph will generate the same result (an array of answers) as the sample graph for the *loop*, but three queries will be issued concurretly.
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
nodes:
|
|
258
|
+
people:
|
|
259
|
+
value: [Steve Jobs, Elon Musk, Nikola Tesla]
|
|
260
|
+
retriever:
|
|
261
|
+
agentId: "mapAgent"
|
|
262
|
+
inputs: ["people"]
|
|
263
|
+
graph:
|
|
264
|
+
nodes:
|
|
265
|
+
query:
|
|
266
|
+
agentId: slashgpt
|
|
267
|
+
params:
|
|
268
|
+
manifest:
|
|
269
|
+
prompt: Describe about the person in less than 100 words
|
|
270
|
+
inputs: ["$0"]
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Here is the conceptual representation of this operation.
|
|
181
274
|
|
|
275
|
+
```mermaid
|
|
276
|
+
flowchart LR
|
|
277
|
+
people -- "[0]" --> query_0(query_0)
|
|
278
|
+
people -- "[1]" --> query_1(query_1)
|
|
279
|
+
people -- "[2]" --> query_2(query_2)
|
|
280
|
+
query_0 --> retriever[[retriever]]
|
|
281
|
+
query_1 --> retriever
|
|
282
|
+
query_2 --> retriever
|
|
283
|
+
```
|
|
182
284
|
### Conditional Flow
|
|
183
285
|
|
|
184
286
|
To be filled.
|
|
185
287
|
|
|
288
|
+
## Concurrency
|
|
289
|
+
|
|
290
|
+
It is possible to specify the maximum number of concurrent execution by setting the *concurrency* property of the graph at the top level. The default is 8.
|
|
291
|
+
|
|
292
|
+
Since the task queue is shared between the parent graph and the children graph (uness the graph is running remotely), tasks created by the child graph will be bound by the same concurrency specified by the parent graph.
|
|
293
|
+
|
|
294
|
+
Since the task executing the nested graph will be in "running" state while tasks within the child graph are runnig, the concurrency limit will be incremented by one when we start running the child graph and restored when it is completed.
|
|
295
|
+
|
|
296
|
+
By default, all the tasks will have a priority "0", which means neutral. By default, all the tasks will be executed in first-in first-out basis.
|
|
297
|
+
|
|
298
|
+
It is possible to change this priority by specifying Node's optional property "priority". The task with higher priority will be executed first.
|
|
299
|
+
|
|
186
300
|
## GraphAI class
|
|
187
301
|
|
|
188
302
|
### ```constructor(data: GraphData, callbackDictonary: AgentFunctionDictonary)```
|
|
189
|
-
Initializes a new instance of the GraphAI
|
|
303
|
+
Initializes a new instance of the GraphAI object with the specified graph data and a dictionary of callback functions.
|
|
190
304
|
|
|
191
305
|
- ```data: GraphData```: The graph data including nodes and optional concurrency limit.
|
|
192
306
|
- ```callbackDictonary: AgentFunctionDictonary | AgentFunction<any, any, any>```: A dictionary mapping agent IDs to their respective callback functions, or a single default callback function to be used for all nodes.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AgentFunction } from "../../graphai";
|
|
2
|
+
export declare const copyAgent: AgentFunction;
|
|
3
|
+
declare const copyAgentInfo: {
|
|
4
|
+
name: string;
|
|
5
|
+
agent: AgentFunction;
|
|
6
|
+
mock: AgentFunction;
|
|
7
|
+
samples: ({
|
|
8
|
+
inputs: {
|
|
9
|
+
color: string;
|
|
10
|
+
model: string;
|
|
11
|
+
}[];
|
|
12
|
+
result: {
|
|
13
|
+
color: string;
|
|
14
|
+
model: string;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
inputs: string[];
|
|
18
|
+
result: string;
|
|
19
|
+
})[];
|
|
20
|
+
description: string;
|
|
21
|
+
category: string[];
|
|
22
|
+
author: string;
|
|
23
|
+
repository: string;
|
|
24
|
+
license: string;
|
|
25
|
+
};
|
|
26
|
+
export default copyAgentInfo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copyAgent = void 0;
|
|
4
|
+
const copyAgent = async ({ inputs }) => {
|
|
5
|
+
const [input] = inputs;
|
|
6
|
+
return input;
|
|
7
|
+
};
|
|
8
|
+
exports.copyAgent = copyAgent;
|
|
9
|
+
const copyAgentInfo = {
|
|
10
|
+
name: "copyAgent",
|
|
11
|
+
agent: exports.copyAgent,
|
|
12
|
+
mock: exports.copyAgent,
|
|
13
|
+
samples: [
|
|
14
|
+
{
|
|
15
|
+
inputs: [{ color: "red", model: "Model 3" }],
|
|
16
|
+
result: { color: "red", model: "Model 3" },
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
inputs: ["Hello World"],
|
|
20
|
+
result: "Hello World",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
description: "Returns inputs[0]",
|
|
24
|
+
category: ["data"],
|
|
25
|
+
author: "Receptron team",
|
|
26
|
+
repository: "https://github.com/receptron/graphai",
|
|
27
|
+
license: "MIT",
|
|
28
|
+
};
|
|
29
|
+
exports.default = copyAgentInfo;
|
|
@@ -2,3 +2,4 @@ export { totalAgent } from "../../experimental_agents/data_agents/total_agent";
|
|
|
2
2
|
export { dataObjectMergeTemplateAgent } from "../../experimental_agents/data_agents/data_object_merge_template_agent";
|
|
3
3
|
export { dataSumTemplateAgent } from "../../experimental_agents/data_agents/data_sum_template_agent";
|
|
4
4
|
export { propertyFilterAgent } from "../../experimental_agents/data_agents/property_filter_agent";
|
|
5
|
+
export { copyAgent } from "../../experimental_agents/data_agents/copy_agent";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.propertyFilterAgent = exports.dataSumTemplateAgent = exports.dataObjectMergeTemplateAgent = exports.totalAgent = void 0;
|
|
3
|
+
exports.copyAgent = exports.propertyFilterAgent = exports.dataSumTemplateAgent = exports.dataObjectMergeTemplateAgent = exports.totalAgent = void 0;
|
|
4
4
|
var total_agent_1 = require("../../experimental_agents/data_agents/total_agent");
|
|
5
5
|
Object.defineProperty(exports, "totalAgent", { enumerable: true, get: function () { return total_agent_1.totalAgent; } });
|
|
6
6
|
var data_object_merge_template_agent_1 = require("../../experimental_agents/data_agents/data_object_merge_template_agent");
|
|
@@ -9,3 +9,5 @@ var data_sum_template_agent_1 = require("../../experimental_agents/data_agents/d
|
|
|
9
9
|
Object.defineProperty(exports, "dataSumTemplateAgent", { enumerable: true, get: function () { return data_sum_template_agent_1.dataSumTemplateAgent; } });
|
|
10
10
|
var property_filter_agent_1 = require("../../experimental_agents/data_agents/property_filter_agent");
|
|
11
11
|
Object.defineProperty(exports, "propertyFilterAgent", { enumerable: true, get: function () { return property_filter_agent_1.propertyFilterAgent; } });
|
|
12
|
+
var copy_agent_1 = require("../../experimental_agents/data_agents/copy_agent");
|
|
13
|
+
Object.defineProperty(exports, "copyAgent", { enumerable: true, get: function () { return copy_agent_1.copyAgent; } });
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.propertyFilterAgent = void 0;
|
|
4
|
-
const
|
|
5
|
-
const [input] = inputs;
|
|
6
|
-
const { include, exclude } = params;
|
|
4
|
+
const applyFilter = (input, include, exclude) => {
|
|
7
5
|
const propIds = include ? include : Object.keys(input);
|
|
8
6
|
const excludeSet = new Set(exclude ?? []);
|
|
9
7
|
return propIds.reduce((tmp, propId) => {
|
|
@@ -13,6 +11,14 @@ const propertyFilterAgent = async ({ inputs, params }) => {
|
|
|
13
11
|
return tmp;
|
|
14
12
|
}, {});
|
|
15
13
|
};
|
|
14
|
+
const propertyFilterAgent = async ({ inputs, params }) => {
|
|
15
|
+
const [input] = inputs;
|
|
16
|
+
const { include, exclude } = params;
|
|
17
|
+
if (Array.isArray(input)) {
|
|
18
|
+
return input.map((item) => applyFilter(item, include, exclude));
|
|
19
|
+
}
|
|
20
|
+
return applyFilter(input, include, exclude);
|
|
21
|
+
};
|
|
16
22
|
exports.propertyFilterAgent = propertyFilterAgent;
|
|
17
23
|
const inputs = [{ color: "red", model: "Model 3", type: "EV", maker: "Tesla", range: 300 }];
|
|
18
24
|
const propertyFilterAgentInfo = {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { AgentFunction } from "../../graphai";
|
|
2
2
|
export declare const mapAgent: AgentFunction<{
|
|
3
3
|
injectionTo?: Array<string>;
|
|
4
|
+
limit?: number;
|
|
4
5
|
}, Record<string, Array<any>>, any>;
|
|
5
6
|
declare const mapAgentInfo: {
|
|
6
7
|
name: string;
|
|
7
8
|
agent: AgentFunction<{
|
|
8
9
|
injectionTo?: string[] | undefined;
|
|
10
|
+
limit?: number | undefined;
|
|
9
11
|
}, Record<string, any[]>, any>;
|
|
10
12
|
mock: AgentFunction<{
|
|
11
13
|
injectionTo?: string[] | undefined;
|
|
14
|
+
limit?: number | undefined;
|
|
12
15
|
}, Record<string, any[]>, any>;
|
|
13
16
|
samples: never[];
|
|
14
17
|
description: string;
|
|
@@ -10,7 +10,10 @@ const mapAgent = async ({ params, inputs, agents, log, taskManager, graphData })
|
|
|
10
10
|
(0, utils_1.assert)(status.concurrency > status.running, `mapAgent: Concurrency is too low: ${status.concurrency}`);
|
|
11
11
|
}
|
|
12
12
|
const nestedGraphData = (0, nested_agent_1.getNestedGraphData)(graphData, inputs);
|
|
13
|
-
const input = Array.isArray(inputs[0]) ? inputs[0] : inputs;
|
|
13
|
+
const input = (Array.isArray(inputs[0]) ? inputs[0] : inputs).map((item) => item);
|
|
14
|
+
if (params.limit && params.limit < input.length) {
|
|
15
|
+
input.length = params.limit; // trim
|
|
16
|
+
}
|
|
14
17
|
const injectionTo = params.injectionTo ??
|
|
15
18
|
inputs.map((__input, index) => {
|
|
16
19
|
return `$${index}`;
|
|
@@ -22,7 +25,7 @@ const mapAgent = async ({ params, inputs, agents, log, taskManager, graphData })
|
|
|
22
25
|
}
|
|
23
26
|
});
|
|
24
27
|
const graphs = input.map((data) => {
|
|
25
|
-
const graphAI = new graphai_1.GraphAI(nestedGraphData, agents || {}, taskManager);
|
|
28
|
+
const graphAI = new graphai_1.GraphAI(nestedGraphData, agents || {}, { taskManager });
|
|
26
29
|
// Only the first input will be mapped
|
|
27
30
|
injectionTo.forEach((injectToNodeId, index) => {
|
|
28
31
|
graphAI.injectValue(injectToNodeId, index === 0 ? data : inputs[index], "__mapAgent_inputs__");
|
|
@@ -37,7 +37,7 @@ const nestedAgent = async ({ params, inputs, agents, log, taskManager, graphData
|
|
|
37
37
|
nestedGraphData.nodes[nodeId] = { value: {} };
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
-
const graphAI = new graphai_1.GraphAI(nestedGraphData, agents || {}, taskManager);
|
|
40
|
+
const graphAI = new graphai_1.GraphAI(nestedGraphData, agents || {}, { taskManager });
|
|
41
41
|
try {
|
|
42
42
|
// Inject inputs to specified source nodes
|
|
43
43
|
injectionTo.forEach((injectToNodeId, index) => {
|
|
@@ -6,6 +6,7 @@ export * from "./matrix_agents";
|
|
|
6
6
|
export * from "./test_agents";
|
|
7
7
|
export * from "./graph_agents";
|
|
8
8
|
export * from "./llm_agents";
|
|
9
|
+
export * from "./service_agents";
|
|
9
10
|
export * from "./embedding_agent";
|
|
10
11
|
export * from "./token_agent";
|
|
11
12
|
export * from "./function_agent";
|
|
@@ -22,6 +22,7 @@ __exportStar(require("./matrix_agents"), exports);
|
|
|
22
22
|
__exportStar(require("./test_agents"), exports);
|
|
23
23
|
__exportStar(require("./graph_agents"), exports);
|
|
24
24
|
__exportStar(require("./llm_agents"), exports);
|
|
25
|
+
__exportStar(require("./service_agents"), exports);
|
|
25
26
|
__exportStar(require("./embedding_agent"), exports);
|
|
26
27
|
__exportStar(require("./token_agent"), exports);
|
|
27
28
|
__exportStar(require("./function_agent"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rssAgent = exports.wikipediaAgent = void 0;
|
|
4
|
+
var wikipedia_1 = require("../../experimental_agents/service_agents/wikipedia");
|
|
5
|
+
Object.defineProperty(exports, "wikipediaAgent", { enumerable: true, get: function () { return wikipedia_1.wikipediaAgent; } });
|
|
6
|
+
var rss_agent_1 = require("../../experimental_agents/service_agents/rss_agent");
|
|
7
|
+
Object.defineProperty(exports, "rssAgent", { enumerable: true, get: function () { return rss_agent_1.rssAgent; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AgentFunction } from "../../graphai";
|
|
2
|
+
export declare const rssAgent: AgentFunction<undefined, any, string>;
|
|
3
|
+
declare const rssAgentInfo: {
|
|
4
|
+
name: string;
|
|
5
|
+
agent: AgentFunction<undefined, any, string>;
|
|
6
|
+
mock: AgentFunction<undefined, any, string>;
|
|
7
|
+
description: string;
|
|
8
|
+
category: string[];
|
|
9
|
+
author: string;
|
|
10
|
+
repository: string;
|
|
11
|
+
license: string;
|
|
12
|
+
};
|
|
13
|
+
export default rssAgentInfo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rssAgent = void 0;
|
|
4
|
+
const xml2js_1 = require("xml2js");
|
|
5
|
+
const rssAgent = async ({ inputs }) => {
|
|
6
|
+
const url = inputs[0];
|
|
7
|
+
try {
|
|
8
|
+
const response = await fetch(url);
|
|
9
|
+
const xmlData = await response.text();
|
|
10
|
+
const jsonData = await (0, xml2js_1.parseStringPromise)(xmlData, { explicitArray: false, mergeAttrs: true });
|
|
11
|
+
return jsonData;
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
console.log(error);
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.rssAgent = rssAgent;
|
|
19
|
+
const rssAgentInfo = {
|
|
20
|
+
name: "rssAgent",
|
|
21
|
+
agent: exports.rssAgent,
|
|
22
|
+
mock: exports.rssAgent,
|
|
23
|
+
description: "Retrieves XML data from RSS feed and convert it to JSON",
|
|
24
|
+
category: ["data"],
|
|
25
|
+
author: "Receptron",
|
|
26
|
+
repository: "https://github.com/receptron/graphai",
|
|
27
|
+
license: "MIT",
|
|
28
|
+
};
|
|
29
|
+
exports.default = rssAgentInfo;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentFunction } from "../../graphai";
|
|
2
|
+
export declare const wikipediaAgent: AgentFunction<{
|
|
3
|
+
lang?: string;
|
|
4
|
+
summary?: boolean;
|
|
5
|
+
}, Record<string, any> | undefined, string>;
|
|
6
|
+
declare const wikipediaAgentInfo: {
|
|
7
|
+
name: string;
|
|
8
|
+
agent: AgentFunction<{
|
|
9
|
+
lang?: string | undefined;
|
|
10
|
+
summary?: boolean | undefined;
|
|
11
|
+
}, Record<string, any> | undefined, string>;
|
|
12
|
+
mock: AgentFunction<{
|
|
13
|
+
lang?: string | undefined;
|
|
14
|
+
summary?: boolean | undefined;
|
|
15
|
+
}, Record<string, any> | undefined, string>;
|
|
16
|
+
description: string;
|
|
17
|
+
category: string[];
|
|
18
|
+
author: string;
|
|
19
|
+
repository: string;
|
|
20
|
+
license: string;
|
|
21
|
+
};
|
|
22
|
+
export default wikipediaAgentInfo;
|
|
@@ -0,0 +1,38 @@
|
|
|
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.wikipediaAgent = void 0;
|
|
7
|
+
const wikipedia_1 = __importDefault(require("wikipedia"));
|
|
8
|
+
const wikipediaAgent = async ({ inputs, params }) => {
|
|
9
|
+
const { lang, summary } = params;
|
|
10
|
+
const query = inputs[0];
|
|
11
|
+
try {
|
|
12
|
+
if (lang) {
|
|
13
|
+
wikipedia_1.default.setLang(lang);
|
|
14
|
+
}
|
|
15
|
+
const search = await wikipedia_1.default.search(query);
|
|
16
|
+
const search_res = search.results[0];
|
|
17
|
+
const page = await wikipedia_1.default.page(search_res["title"]);
|
|
18
|
+
const content = await (summary ? page.summary() : page.content());
|
|
19
|
+
return { content, ...search.results[0] };
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.log(error);
|
|
23
|
+
//=> Typeof wikiError
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
};
|
|
27
|
+
exports.wikipediaAgent = wikipediaAgent;
|
|
28
|
+
const wikipediaAgentInfo = {
|
|
29
|
+
name: "wikipediaAgent",
|
|
30
|
+
agent: exports.wikipediaAgent,
|
|
31
|
+
mock: exports.wikipediaAgent,
|
|
32
|
+
description: "Retrieves data from wikipedia",
|
|
33
|
+
category: ["data"],
|
|
34
|
+
author: "Receptron",
|
|
35
|
+
repository: "https://github.com/receptron/graphai",
|
|
36
|
+
license: "MIT",
|
|
37
|
+
};
|
|
38
|
+
exports.default = wikipediaAgentInfo;
|
|
@@ -4,3 +4,4 @@ export { copyMessageAgent } from "../../experimental_agents/test_agents/copy_mes
|
|
|
4
4
|
export { mergeNodeIdAgent } from "../../experimental_agents/test_agents/merge_node_id_agent";
|
|
5
5
|
export { countingAgent } from "../../experimental_agents/test_agents/counting_agent";
|
|
6
6
|
export { copy2ArrayAgent } from "../../experimental_agents/test_agents/copy2array_agent";
|
|
7
|
+
export { streamMockAgent } from "../../experimental_agents/test_agents/stream_mock_agent";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copy2ArrayAgent = exports.countingAgent = exports.mergeNodeIdAgent = exports.copyMessageAgent = exports.echoAgent = exports.bypassAgent = void 0;
|
|
3
|
+
exports.streamMockAgent = exports.copy2ArrayAgent = exports.countingAgent = exports.mergeNodeIdAgent = exports.copyMessageAgent = exports.echoAgent = exports.bypassAgent = void 0;
|
|
4
4
|
var bypass_agent_1 = require("../../experimental_agents/test_agents/bypass_agent");
|
|
5
5
|
Object.defineProperty(exports, "bypassAgent", { enumerable: true, get: function () { return bypass_agent_1.bypassAgent; } });
|
|
6
6
|
var echo_agent_1 = require("../../experimental_agents/test_agents/echo_agent");
|
|
@@ -13,3 +13,5 @@ var counting_agent_1 = require("../../experimental_agents/test_agents/counting_a
|
|
|
13
13
|
Object.defineProperty(exports, "countingAgent", { enumerable: true, get: function () { return counting_agent_1.countingAgent; } });
|
|
14
14
|
var copy2array_agent_1 = require("../../experimental_agents/test_agents/copy2array_agent");
|
|
15
15
|
Object.defineProperty(exports, "copy2ArrayAgent", { enumerable: true, get: function () { return copy2array_agent_1.copy2ArrayAgent; } });
|
|
16
|
+
var stream_mock_agent_1 = require("../../experimental_agents/test_agents/stream_mock_agent");
|
|
17
|
+
Object.defineProperty(exports, "streamMockAgent", { enumerable: true, get: function () { return stream_mock_agent_1.streamMockAgent; } });
|
|
@@ -4,4 +4,5 @@ import countingAgent from "../../experimental_agents/test_agents/counting_agent"
|
|
|
4
4
|
import copyMessageAgent from "../../experimental_agents/test_agents/copy_message_agent";
|
|
5
5
|
import copy2ArrayAgent from "../../experimental_agents/test_agents/copy2array_agent";
|
|
6
6
|
import mergeNodeIdAgent from "../../experimental_agents/test_agents/merge_node_id_agent";
|
|
7
|
-
|
|
7
|
+
import streamMockAgent from "../../experimental_agents/test_agents/stream_mock_agent";
|
|
8
|
+
export { echoAgent, bypassAgent, countingAgent, copyMessageAgent, copy2ArrayAgent, mergeNodeIdAgent, streamMockAgent };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.mergeNodeIdAgent = exports.copy2ArrayAgent = exports.copyMessageAgent = exports.countingAgent = exports.bypassAgent = exports.echoAgent = void 0;
|
|
6
|
+
exports.streamMockAgent = exports.mergeNodeIdAgent = exports.copy2ArrayAgent = exports.copyMessageAgent = exports.countingAgent = exports.bypassAgent = exports.echoAgent = void 0;
|
|
7
7
|
const echo_agent_1 = __importDefault(require("../../experimental_agents/test_agents/echo_agent"));
|
|
8
8
|
exports.echoAgent = echo_agent_1.default;
|
|
9
9
|
const bypass_agent_1 = __importDefault(require("../../experimental_agents/test_agents/bypass_agent"));
|
|
@@ -16,3 +16,5 @@ const copy2array_agent_1 = __importDefault(require("../../experimental_agents/te
|
|
|
16
16
|
exports.copy2ArrayAgent = copy2array_agent_1.default;
|
|
17
17
|
const merge_node_id_agent_1 = __importDefault(require("../../experimental_agents/test_agents/merge_node_id_agent"));
|
|
18
18
|
exports.mergeNodeIdAgent = merge_node_id_agent_1.default;
|
|
19
|
+
const stream_mock_agent_1 = __importDefault(require("../../experimental_agents/test_agents/stream_mock_agent"));
|
|
20
|
+
exports.streamMockAgent = stream_mock_agent_1.default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamMockAgent = void 0;
|
|
4
|
+
const utils_1 = require("../../utils/utils");
|
|
5
|
+
const streamMockAgent = async ({ params }) => {
|
|
6
|
+
const message = params.message;
|
|
7
|
+
for await (const token of message.split("")) {
|
|
8
|
+
if (params.streamCallback) {
|
|
9
|
+
params.streamCallback(token);
|
|
10
|
+
}
|
|
11
|
+
await (0, utils_1.sleep)(params.sleep || 100);
|
|
12
|
+
}
|
|
13
|
+
return params;
|
|
14
|
+
};
|
|
15
|
+
exports.streamMockAgent = streamMockAgent;
|
|
16
|
+
// for test and document
|
|
17
|
+
const streamMockAgentInfo = {
|
|
18
|
+
name: "streamMockAgent",
|
|
19
|
+
agent: exports.streamMockAgent,
|
|
20
|
+
mock: exports.streamMockAgent,
|
|
21
|
+
samples: [],
|
|
22
|
+
description: "Sstream mock agent",
|
|
23
|
+
category: [],
|
|
24
|
+
author: "xSatoshi Nakajima",
|
|
25
|
+
repository: "https://github.com/receptron/graphai",
|
|
26
|
+
license: "MIT",
|
|
27
|
+
};
|
|
28
|
+
exports.default = streamMockAgentInfo;
|
package/lib/graphai.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AgentFunction, AgentFunctionDictonary, GraphData } from "./type";
|
|
2
|
-
import { AgentFunctionDictonary, GraphData, DataSource, ResultDataDictonary, ResultData, DefaultResultData } from "./type";
|
|
2
|
+
import { AgentFunctionDictonary, AgentFilterInfo, GraphData, DataSource, ResultDataDictonary, ResultData, DefaultResultData } from "./type";
|
|
3
3
|
import { TransactionLog } from "./transaction_log";
|
|
4
4
|
import { ComputedNode, StaticNode } from "./node";
|
|
5
5
|
import { TaskManager } from "./task_manager";
|
|
@@ -12,6 +12,7 @@ export declare class GraphAI {
|
|
|
12
12
|
private readonly logs;
|
|
13
13
|
readonly callbackDictonary: AgentFunctionDictonary;
|
|
14
14
|
readonly taskManager: TaskManager;
|
|
15
|
+
readonly agentFilters: AgentFilterInfo[];
|
|
15
16
|
readonly retryLimit?: number;
|
|
16
17
|
nodes: GraphNodes;
|
|
17
18
|
onLogCallback: (__log: TransactionLog, __isUpdate: boolean) => void;
|
|
@@ -21,7 +22,10 @@ export declare class GraphAI {
|
|
|
21
22
|
private createNodes;
|
|
22
23
|
private getValueFromResults;
|
|
23
24
|
private initializeNodes;
|
|
24
|
-
constructor(data: GraphData, callbackDictonary: AgentFunctionDictonary,
|
|
25
|
+
constructor(data: GraphData, callbackDictonary: AgentFunctionDictonary, options?: {
|
|
26
|
+
agentFilters?: AgentFilterInfo[] | undefined;
|
|
27
|
+
taskManager?: TaskManager | undefined;
|
|
28
|
+
});
|
|
25
29
|
getCallback(agentId?: string): import("./type").AgentFunction<any, any, any>;
|
|
26
30
|
asString(): string;
|
|
27
31
|
results<T = DefaultResultData>(all: boolean): ResultDataDictonary<T>;
|
package/lib/graphai.js
CHANGED
|
@@ -65,7 +65,7 @@ class GraphAI {
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
constructor(data, callbackDictonary,
|
|
68
|
+
constructor(data, callbackDictonary, options = { taskManager: undefined, agentFilters: [] }) {
|
|
69
69
|
this.logs = [];
|
|
70
70
|
this.onLogCallback = (__log, __isUpdate) => { };
|
|
71
71
|
this.repeatCount = 0;
|
|
@@ -77,7 +77,8 @@ class GraphAI {
|
|
|
77
77
|
this.graphId = URL.createObjectURL(new Blob()).slice(-36);
|
|
78
78
|
this.data = data;
|
|
79
79
|
this.callbackDictonary = callbackDictonary;
|
|
80
|
-
this.taskManager = taskManager ?? new task_manager_1.TaskManager(data.concurrency ?? defaultConcurrency);
|
|
80
|
+
this.taskManager = options.taskManager ?? new task_manager_1.TaskManager(data.concurrency ?? defaultConcurrency);
|
|
81
|
+
this.agentFilters = options.agentFilters ?? [];
|
|
81
82
|
this.loop = data.loop;
|
|
82
83
|
this.verbose = data.verbose === true;
|
|
83
84
|
this.onComplete = () => {
|
package/lib/node.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class ComputedNode extends Node {
|
|
|
19
19
|
readonly nestedGraph?: GraphData;
|
|
20
20
|
readonly retryLimit: number;
|
|
21
21
|
retryCount: number;
|
|
22
|
-
readonly agentId
|
|
22
|
+
readonly agentId: string;
|
|
23
23
|
readonly timeout?: number;
|
|
24
24
|
readonly priority: number;
|
|
25
25
|
error?: Error;
|
|
@@ -37,6 +37,8 @@ export declare class ComputedNode extends Node {
|
|
|
37
37
|
removePending(nodeId: string): void;
|
|
38
38
|
private isCurrentTransaction;
|
|
39
39
|
private executeTimeout;
|
|
40
|
+
private shouldApplyAgentFilter;
|
|
41
|
+
private agentFilterHandler;
|
|
40
42
|
execute(): Promise<void>;
|
|
41
43
|
private prepareExecute;
|
|
42
44
|
private errorProcess;
|
package/lib/node.js
CHANGED
|
@@ -117,6 +117,34 @@ class ComputedNode extends Node {
|
|
|
117
117
|
this.retry(type_1.NodeState.TimedOut, Error("Timeout"));
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
+
// Check if we need to apply this filter to this node or not.
|
|
121
|
+
shouldApplyAgentFilter(agentFilter) {
|
|
122
|
+
if (agentFilter.agentIds && Array.isArray(agentFilter.agentIds) && agentFilter.agentIds.length > 0) {
|
|
123
|
+
if (agentFilter.agentIds.includes(this.agentId)) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (agentFilter.nodeIds && Array.isArray(agentFilter.nodeIds) && agentFilter.nodeIds.length > 0) {
|
|
128
|
+
if (agentFilter.nodeIds.includes(this.nodeId)) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return !agentFilter.agentIds && !agentFilter.nodeIds;
|
|
133
|
+
}
|
|
134
|
+
agentFilterHandler(context, agent) {
|
|
135
|
+
let index = 0;
|
|
136
|
+
const next = (context) => {
|
|
137
|
+
const agentFilter = this.graph.agentFilters[index++];
|
|
138
|
+
if (agentFilter) {
|
|
139
|
+
if (this.shouldApplyAgentFilter(agentFilter)) {
|
|
140
|
+
return agentFilter.agent(context, next);
|
|
141
|
+
}
|
|
142
|
+
return next(context);
|
|
143
|
+
}
|
|
144
|
+
return agent(context);
|
|
145
|
+
};
|
|
146
|
+
return next(context);
|
|
147
|
+
}
|
|
120
148
|
// This method is called when this computed node became ready to run.
|
|
121
149
|
// It asynchronously calls the associated with agent function and set the result,
|
|
122
150
|
// then it removes itself from the "running node" list of the graph.
|
|
@@ -154,7 +182,7 @@ class ComputedNode extends Node {
|
|
|
154
182
|
context.graphData = this.nestedGraph;
|
|
155
183
|
context.agents = this.graph.callbackDictonary;
|
|
156
184
|
}
|
|
157
|
-
const result = await
|
|
185
|
+
const result = await this.agentFilterHandler(context, callback);
|
|
158
186
|
if (this.nestedGraph) {
|
|
159
187
|
this.graph.taskManager.restoreAfterNesting();
|
|
160
188
|
}
|
package/lib/type.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export type GraphData = {
|
|
|
49
49
|
verbose?: boolean;
|
|
50
50
|
retry?: number;
|
|
51
51
|
};
|
|
52
|
-
export type AgentFunctionContext<ParamsType, InputDataType> = {
|
|
52
|
+
export type AgentFunctionContext<ParamsType = DefaultParamsType, InputDataType = DefaultInputData> = {
|
|
53
53
|
params: NodeDataParams<ParamsType>;
|
|
54
54
|
inputs: Array<InputDataType>;
|
|
55
55
|
debugInfo: {
|
|
@@ -63,6 +63,13 @@ export type AgentFunctionContext<ParamsType, InputDataType> = {
|
|
|
63
63
|
taskManager?: TaskManager;
|
|
64
64
|
};
|
|
65
65
|
export type AgentFunction<ParamsType = DefaultParamsType, ResultType = DefaultResultData, InputDataType = DefaultInputData> = (context: AgentFunctionContext<ParamsType, InputDataType>) => Promise<ResultData<ResultType>>;
|
|
66
|
+
export type AgentFilterFunction<ParamsType = DefaultParamsType, ResultType = DefaultResultData, InputDataType = DefaultInputData> = (context: AgentFunctionContext<ParamsType, InputDataType>, agent: AgentFunction) => Promise<ResultData<ResultType>>;
|
|
67
|
+
export type AgentFilterInfo = {
|
|
68
|
+
name: string;
|
|
69
|
+
agent: AgentFilterFunction;
|
|
70
|
+
agentIds?: string[];
|
|
71
|
+
nodeIds?: string[];
|
|
72
|
+
};
|
|
66
73
|
export type AgentFunctionDictonary = Record<string, AgentFunction<any, any, any>>;
|
|
67
74
|
export type AgentFunctionInfo = {
|
|
68
75
|
name: string;
|
package/lib/utils/test_agents.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphai",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Asynchronous data flow execution engine for agentic AI apps.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@inquirer/prompts": "^5.0.0",
|
|
31
31
|
"@types/express": "^4.17.21",
|
|
32
32
|
"@types/node": "^20.8.7",
|
|
33
|
+
"@types/xml2js": "^0.4.14",
|
|
33
34
|
"@typescript-eslint/eslint-plugin": "^6.8.0",
|
|
34
35
|
"@typescript-eslint/parser": "^6.8.0",
|
|
35
36
|
"arxiv-api-ts": "^1.0.3",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"tsconfig-paths": "^4.2.0",
|
|
49
50
|
"typescript": "^5.2.2",
|
|
50
51
|
"wikipedia": "^2.1.2",
|
|
52
|
+
"xml2js": "^0.6.2",
|
|
51
53
|
"yaml": "^2.4.1"
|
|
52
54
|
},
|
|
53
55
|
"types": "./lib/index.d.ts",
|