graphai 0.5.21 → 0.6.1
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/lib/node.d.ts +0 -1
- package/lib/node.js +16 -12
- package/lib/type.d.ts +0 -1
- package/package.json +2 -2
package/lib/node.d.ts
CHANGED
package/lib/node.js
CHANGED
|
@@ -59,10 +59,10 @@ class ComputedNode extends Node {
|
|
|
59
59
|
this.priority = data.priority ?? 0;
|
|
60
60
|
this.anyInput = data.anyInput ?? false;
|
|
61
61
|
this.inputs = data.inputs;
|
|
62
|
-
this.isNamedInputs =
|
|
62
|
+
// this.isNamedInputs = isObject(data.inputs) && !Array.isArray(data.inputs);
|
|
63
63
|
this.dataSources = data.inputs ? (0, nodeUtils_1.inputs2dataSources)(data.inputs).flat(10) : [];
|
|
64
|
-
if (data.inputs &&
|
|
65
|
-
|
|
64
|
+
if (data.inputs && Array.isArray(data.inputs)) {
|
|
65
|
+
throw new Error(`array inputs have been deprecated. nodeId: ${nodeId}: see https://github.com/receptron/graphai/blob/main/docs/NamedInputs.md`);
|
|
66
66
|
}
|
|
67
67
|
this.pendings = new Set((0, nodeUtils_1.dataSourceNodeIds)(this.dataSources));
|
|
68
68
|
(0, utils_2.assert)(["function", "string"].includes(typeof data.agent), "agent must be either string or function");
|
|
@@ -71,7 +71,8 @@ class ComputedNode extends Node {
|
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
const agent = data.agent;
|
|
74
|
-
this.agentFunction = this.isNamedInputs ? async ({ namedInputs, params }) => agent(namedInputs, params) : async ({ inputs }) => agent(...inputs);
|
|
74
|
+
// this.agentFunction = this.isNamedInputs ? async ({ namedInputs, params }) => agent(namedInputs, params) : async ({ inputs }) => agent(...inputs);
|
|
75
|
+
this.agentFunction = async ({ namedInputs, params }) => agent(namedInputs, params);
|
|
75
76
|
}
|
|
76
77
|
if (data.graph) {
|
|
77
78
|
this.nestedGraph = typeof data.graph === "string" ? this.addPendingNode(data.graph) : data.graph;
|
|
@@ -299,17 +300,19 @@ class ComputedNode extends Node {
|
|
|
299
300
|
return tmp;
|
|
300
301
|
}, { ...this.params });
|
|
301
302
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
/*
|
|
304
|
+
private getInputs(previousResults: Record<string, ResultData | undefined>) {
|
|
305
|
+
if (Array.isArray(this.inputs)) {
|
|
306
|
+
return (this.inputs ?? []).map((key) => previousResults[String(key)]).filter((a) => !this.anyInput || a);
|
|
307
|
+
}
|
|
308
|
+
return [];
|
|
307
309
|
}
|
|
310
|
+
*/
|
|
308
311
|
getContext(previousResults, localLog) {
|
|
309
312
|
const context = {
|
|
310
313
|
params: this.getParams(),
|
|
311
|
-
inputs: this.getInputs(previousResults),
|
|
312
|
-
namedInputs:
|
|
314
|
+
// inputs: this.getInputs(previousResults),
|
|
315
|
+
namedInputs: previousResults,
|
|
313
316
|
inputSchema: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(this.agentId)?.inputs,
|
|
314
317
|
debugInfo: this.getDebugInfo(),
|
|
315
318
|
cacheType: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(this.agentId)?.cacheType,
|
|
@@ -343,7 +346,8 @@ class ComputedNode extends Node {
|
|
|
343
346
|
}
|
|
344
347
|
beforeConsoleLog(context) {
|
|
345
348
|
if (this.console.before === true) {
|
|
346
|
-
console.log(JSON.stringify(this.isNamedInputs ? context.namedInputs : context.inputs, null, 2));
|
|
349
|
+
// console.log(JSON.stringify(this.isNamedInputs ? context.namedInputs : context.inputs, null, 2));
|
|
350
|
+
console.log(JSON.stringify(context.namedInputs, null, 2));
|
|
347
351
|
}
|
|
348
352
|
else if (this.console.before) {
|
|
349
353
|
console.log(this.console.before);
|
package/lib/type.d.ts
CHANGED
|
@@ -77,7 +77,6 @@ export type GraphOptions = {
|
|
|
77
77
|
export type CacheTypes = "pureAgent" | "impureAgent";
|
|
78
78
|
export type AgentFunctionContext<ParamsType = DefaultParamsType, InputDataType = DefaultInputData, NamedInputDataType = DefaultInputData> = {
|
|
79
79
|
params: NodeDataParams<ParamsType>;
|
|
80
|
-
inputs: Array<InputDataType>;
|
|
81
80
|
inputSchema?: any;
|
|
82
81
|
namedInputs: NamedInputDataType;
|
|
83
82
|
debugInfo: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Asynchronous data flow execution engine for agentic AI apps.",
|
|
5
5
|
"main": "lib/bundle.cjs.js",
|
|
6
6
|
"module": "lib/bundle.esm.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/receptron/graphai#readme",
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"typedoc": "^0.
|
|
30
|
+
"typedoc": "^0.27.2"
|
|
31
31
|
},
|
|
32
32
|
"types": "./lib/index.d.ts",
|
|
33
33
|
"directories": {
|