subgraphWithVerification

fun <Input : Any> subgraphWithVerification(name: String? = null, inputType: TypeToken, toolSelectionStrategy: ToolSelectionStrategy, llmModel: LLModel? = null, llmParams: LLMParams? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, responseProcessor: ResponseProcessor? = null, defineTask: suspend AIAgentGraphContextBase.(input: Input) -> String): AIAgentSubgraphDelegate<Input, CriticResult<Input>>(source)
inline fun <Input : Any> subgraphWithVerification(toolSelectionStrategy: ToolSelectionStrategy, llmModel: LLModel? = null, llmParams: LLMParams? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, responseProcessor: ResponseProcessor? = null, noinline defineTask: suspend AIAgentGraphContextBase.(input: Input) -> String): AIAgentSubgraphDelegate<Input, CriticResult<Input>>(source)

subgraphWithTask with CriticResult result. It verifies if the task was performed correctly or not, and describes the problems if any.

Return

A delegate representing the constructed subgraph with verification result.

Parameters

toolSelectionStrategy

The strategy used to select tools for the subgraph operations.

llmModel

Optional language model to be used within the subgraph. Defaults to null.

llmParams

Optional parameters for configuring the language model behavior. Defaults to null.

runMode

The mode in which tools are executed. Defaults to sequential execution.

assistantResponseRepeatMax

The maximum number of assistant responses allowed before determining that the task cannot be completed.

responseProcessor

An optional processor defining the post-processing of messages returned from the LLM.

defineTask

A suspending lambda function that defines the task for the subgraph, taking the input as a parameter.

Type Parameters

Input

The input type accepted by the subgraph.


inline fun <Input : Any> subgraphWithVerification(tools: List<Tool<*, *>>, llmModel: LLModel? = null, llmParams: LLMParams? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, responseProcessor: ResponseProcessor? = null, noinline defineTask: suspend AIAgentGraphContextBase.(input: Input) -> String): AIAgentSubgraphDelegate<Input, CriticResult<Input>>(source)

Constructs a subgraph within an AI agent's strategy graph with additional verification capabilities.

This method defines a subgraph using a given list of tools, an optional language model, and optional language model parameters. It also allows specifying whether to summarize the interaction history and defines the task to be executed in the subgraph.

Return

A delegate representing the constructed subgraph with input type Input and output type as a verified subgraph result CriticResult.

Parameters

tools

A list of tools available to the subgraph.

llmModel

Optional language model to be used within the subgraph.

llmParams

Optional parameters to configure the language model's behavior.

runMode

The mode in which tools are executed. Defaults to sequential execution.

assistantResponseRepeatMax

The maximum number of assistant responses allowed before determining that the task cannot be completed.

responseProcessor

An optional processor defining the post-processing of messages returned from the LLM.

defineTask

A suspendable function defining the task that the subgraph will execute, which takes an input and produces a string-based task description.

Type Parameters

Input

The input type accepted by the subgraph.