graphai 2.0.14 → 2.0.15

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/graphai.d.ts CHANGED
@@ -32,7 +32,7 @@ export declare class GraphAI {
32
32
  private setStaticNodeResults;
33
33
  private updateStaticNodes;
34
34
  constructor(graphData: GraphData, agentFunctionInfoDictionary: AgentFunctionInfoDictionary, options?: GraphOptions);
35
- getAgentFunctionInfo(agentId?: string): import("./type").AgentFunctionInfo | {
35
+ getAgentFunctionInfo(agentId?: string, nodeId?: string): import("./type").AgentFunctionInfo | {
36
36
  agent: () => Promise<null>;
37
37
  hasGraphData: boolean;
38
38
  inputs: null;
package/lib/graphai.js CHANGED
@@ -130,7 +130,7 @@ class GraphAI {
130
130
  };
131
131
  this.nodes = this.createNodes(this.graphData);
132
132
  }
133
- getAgentFunctionInfo(agentId) {
133
+ getAgentFunctionInfo(agentId, nodeId) {
134
134
  if (agentId && this.agentFunctionInfoDictionary[agentId]) {
135
135
  return this.agentFunctionInfoDictionary[agentId];
136
136
  }
@@ -145,6 +145,9 @@ class GraphAI {
145
145
  };
146
146
  }
147
147
  // We are not supposed to hit this error because the validator will catch it.
148
+ if (nodeId) {
149
+ throw new Error(`No agent: ${agentId} in ${nodeId} node`);
150
+ }
148
151
  throw new Error("No agent: " + agentId);
149
152
  }
150
153
  asString() {
package/lib/node.js CHANGED
@@ -254,7 +254,7 @@ class ComputedNode extends Node {
254
254
  if (typeof agentId === "function") {
255
255
  this.agentFunction = agentId;
256
256
  }
257
- const hasNestedGraph = Boolean(this.nestedGraph) || Boolean(agentId && this.graph.getAgentFunctionInfo(agentId).hasGraphData);
257
+ const hasNestedGraph = Boolean(this.nestedGraph) || Boolean(typeof agentId === "string" && this.graph.getAgentFunctionInfo(agentId, this.nodeId).hasGraphData);
258
258
  const config = this.getConfig(hasNestedGraph, agentId);
259
259
  const transactionId = Date.now();
260
260
  this.prepareExecute(transactionId, previousResults, agentId);
@@ -264,7 +264,7 @@ class ComputedNode extends Node {
264
264
  }, this.timeout);
265
265
  }
266
266
  try {
267
- const agentFunction = this.agentFunction ?? this.graph.getAgentFunctionInfo(agentId).agent;
267
+ const agentFunction = this.agentFunction ?? this.graph.getAgentFunctionInfo(agentId, this.nodeId).agent;
268
268
  const localLog = [];
269
269
  const context = this.getContext(previousResults, localLog, agentId, config);
270
270
  // NOTE: We use the existence of graph object in the agent-specific params to determine
@@ -373,9 +373,9 @@ class ComputedNode extends Node {
373
373
  //params: this.graph.resultsOf(this.params),
374
374
  params,
375
375
  namedInputs: previousResults,
376
- inputSchema: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.inputs,
376
+ inputSchema: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId, this.nodeId)?.inputs,
377
377
  debugInfo: this.debugInfo,
378
- cacheType: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.cacheType,
378
+ cacheType: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId, this.nodeId)?.cacheType,
379
379
  filterParams: this.filterParams,
380
380
  config,
381
381
  log: localLog,
@@ -39,7 +39,7 @@ const innerGetDataFromSource = (result, propIds, propFunctions) => {
39
39
  const propId = propIds[0];
40
40
  const ret = getNestedData(result, propId, propFunctions);
41
41
  if (ret === undefined) {
42
- GraphAILogger_1.GraphAILogger.info(`prop: ${propIds.join(".")} is not hit`);
42
+ GraphAILogger_1.GraphAILogger.debug(`prop: ${propIds.join(".")} is not hit`);
43
43
  }
44
44
  if (propIds.length > 1) {
45
45
  return innerGetDataFromSource(ret, propIds.slice(1), propFunctions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphai",
3
- "version": "2.0.14",
3
+ "version": "2.0.15",
4
4
  "description": "Asynchronous data flow execution engine for agentic AI apps.",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/receptron/graphai#readme",
29
29
  "devDependencies": {
30
- "typedoc": "^0.28.10",
30
+ "typedoc": "^0.28.12",
31
31
  "typedoc-plugin-markdown": "^4.8.1"
32
32
  },
33
33
  "types": "./lib/index.d.ts",