subgraphWithTask
Creates a subgraph, which performs one specific task, defined by defineTask, using the tools defined by toolSelectionStrategy. When LLM believes that the task is finished, it will call finishTool, generating ProvidedResult as its argument. The generated ProvidedResult is the result of this subgraph. The subgraph returns a wrapper SafeTool.Result to handle cases when the model didn't reach the finish condition or didn't generate a final ProvidedResult due to an error (reported as SafeTool.Result.Failure)
Use this function if you need the agent to perform a single task which outputs a structured result.
Creates a subgraph with a task definition and specified tools. The subgraph uses the provided tools to process input and execute the defined task, eventually producing a result through the provided finish tool.
Return
A delegate representing the subgraph that processes the input and produces a result through the finish tool.
Parameters
The list of tools that are available for use within the subgraph.
The tool responsible for producing the final result of the subgraph.
An optional language model to be used in the subgraph. If not specified, a default model may be used.
Optional parameters to customize the behavior of the language model in the subgraph.
A suspend function that defines the task to be executed by the subgraph based on the given input.
subgraphWithTask with StringSubgraphResult result.
Creates a subgraph with a predefined task definition using the provided tools, model, and parameters.
This function allows you to define a subgraph where a specific task is executed as part of the AI agent's strategy graph. The task is determined based on the provided task definition logic, which is executed in the given context.
Return
A delegate representing the constructed subgraph with task execution capabilities.
Parameters
A list of tools available for use within the subgraph.
An optional language model to be used within the subgraph. Defaults to null
.
Optional parameters for the language model. Defaults to null
.
A suspendable function that defines the task for the subgraph, given an input in the context.