Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 2.06 KB

APIDocument.md

File metadata and controls

34 lines (21 loc) · 2.06 KB

GraphAI class

constructor(data: GraphData, callbackDictonary: AgentFunctionInfoDictonary)

Initializes a new instance of the GraphAI object with the specified graph data and a dictionary of callback functions.

  • data: GraphData: The graph data including nodes and optional concurrency limit.
  • callbackDictonary: AgentFunctionInfoDictonary: A dictionary mapping agent IDs to their respective callback functions info to be used for all nodes.

async run(): Promise<ResultDataDictonary<ResultData>>

Executes the graph asynchronously, starting with nodes that have no dependencies or whose dependencies have been met. The method continues to execute nodes as their dependencies are satisfied until all nodes have been executed or an error occurs.

Returns: A promise that resolves with the results of all executed nodes or rejects with the first encountered error.

results(): ResultDataDictonary<ResultData>

Compiles and returns the results of all executed nodes in the graph.

Returns: A dictionary mapping node IDs to their results. Only includes nodes that have completed execution and produced a result.

errors(): Record<string, Error>

Compiles and returns the errors from all nodes that encountered an error during execution.

Returns: A dictionary mapping node IDs to the errors they encountered. Only includes nodes that have executed and encountered an error. It does not include any errors which have been retried.

transactionLogs(): Array<TransactionLog>

Retrieves all transaction logs recorded during the execution of the graph.

Returns: An array of transaction logs detailing the execution states and outcomes of the nodes within the graph.

injectValue(nodeId: string, result: ResultData): void

Injects a result into a specified node. This is used to manually set the result of a static node, allowing dependent nodes to proceed with execution.

  • nodeId: string: The ID of the static node into which the result is to be injected.
  • result: ResultData: The result to be injected into the specified node.