SubtaskBuilderWithInputAndOutput

class SubtaskBuilderWithInputAndOutput<Input, Output : Any>(val context: AIAgentFunctionalContextBase<*>, val taskDescription: String, val input: Input, val output: OutputOption<Output>, var tools: List<Tool<*, *>>? = null, var llmModel: LLModel? = null, var llmParams: LLMParams? = null, var responseProcessor: ResponseProcessor? = null, var runMode: ToolCalls = ToolCalls.SEQUENTIAL, var assistantResponseRepeatMax: Int? = null, var executorService: ERROR CLASS: Symbol not found for ExecutorService?? = null)(source)

Builder class to create and configure a subtask with specified input and output types.

Parameters

Input

The type of the input required for the subtask.

Output

The type of the output produced by the subtask.

context

The functional context associated with the AI agent.

taskDescription

The description of the task that this subtask represents.

input

The input data required for the subtask.

output

Specifies the output of the subtask either by its class or through a finish tool.

tools

Optional list of tools that can be used during the subtask execution.

llmModel

Optional language model to be used for the subtask.

llmParams

Optional parameters for the language model configuration.

responseProcessor

Optional processor for post-processing LLM responses.

runMode

Specifies the mode in which tools should be called (e.g., sequentially).

assistantResponseRepeatMax

Optional maximum number of response repetitions allowed for the assistant.

executorService

Optional executor service for managing asynchronous operations.

Constructors

Link copied to clipboard
constructor(context: AIAgentFunctionalContextBase<*>, taskDescription: String, input: Input, output: OutputOption<Output>, tools: List<Tool<*, *>>? = null, llmModel: LLModel? = null, llmParams: LLMParams? = null, responseProcessor: ResponseProcessor? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, executorService: ERROR CLASS: Symbol not found for ExecutorService?? = null)
constructor(context: AIAgentFunctionalContextBase<*>, taskDescription: String, input: Input, outputClass: ERROR CLASS: Symbol not found for Class<Output>)

Constructs a new instance of SubtaskBuilderWithInputAndOutput. This constructor allows specifying the context, task description, input, and the output class type, which will be used to configure the subtask builder for tasks requiring both input and output processing.

constructor(context: AIAgentFunctionalContextBase<*>, taskDescription: String, input: Input, finishTool: Tool<*, Output>)

Secondary constructor for initializing an instance of SubtaskBuilderWithInputAndOutput with a specific context, task description, input, and a finalizing tool for output processing.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var executorService: ERROR CLASS: Symbol not found for ExecutorService??
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var tools: List<Tool<*, *>>?

Functions

Link copied to clipboard

Sets the maximum number of times the assistant's response can be repeated.

Link copied to clipboard
fun run(): Output

Executes the defined task within the configured context and returns the output. The method handles different output options (OutputOption.ByClass and OutputOption.ByFinishTool) and executes subtasks using the provided input, tools, and configuration parameters.

Link copied to clipboard

Sets the execution mode for the AI agent's task execution.

Link copied to clipboard

Configures the builder to use the specified Large Language Model (LLM) for subsequent tasks.

Link copied to clipboard
fun withExecutorService(service: ERROR CLASS: Symbol not found for ExecutorService): SubtaskBuilderWithInputAndOutput<Input, Output>

Configures the subtask builder to use the specified ExecutorService for task execution.

Link copied to clipboard

Sets the parameters for the language model (LLM) to be used in the subtask.

Link copied to clipboard

Sets the response processor to be used for post-processing LLM responses during task execution.

Link copied to clipboard
fun withTools(vararg toolSets: ERROR CLASS: Symbol not found for ToolSet): SubtaskBuilderWithInputAndOutput<Input, Output>

Adds the specified sets of tools to the subtask configuration.

Sets the tools to be used for the subtask configuration.