AIAgentLLMWriteSession
A session for managing interactions with a language learning model (LLM) and tools in an agent environment. This class provides functionality for executing LLM requests, managing tools, and customizing prompts dynamically within a specific session context.
Properties
Functions
Invokes a tool of the specified type with the provided arguments.
Executes the specified tool with the given arguments and returns the result within a SafeTool.Result wrapper.
Executes a tool by its name with the provided arguments.
Executes a tool operation based on the provided tool class and arguments.
Invokes a specified tool function within the AI Agent's write session context.
Updates the language model's parameters used in the current session prompt.
Updates the underlying model in the current prompt with the specified new model.
Executes a parallelized tool call using the provided data flow and tool function within the session.
Executes parallel tool calls in a raw format using the provided flow of data arguments.
Finds and retrieves a tool of the specified type from the current stage of the tool registry. If no tool of the given type is found, an exception is thrown.
Finds and retrieves a tool of the specified type from the tool registry.
Finds a specific tool within the tool registry using the given tool function and returns it as a safe tool.
Finds and retrieves a tool by its name and argument/result types.
Rewrites LLM message history, leaving only user message and resulting TLDR.
Makes an asynchronous request to a Large Language Model (LLM) and updates the current prompt with the response received from the LLM.
Requests an LLM (Large Language Model) to forcefully utilize a specific tool during its operation.
Requests the execution of a single specified tool, enforcing its use, and updates the prompt based on the generated response.
Requests multiple responses from the LLM and updates the prompt with the received responses.
Requests a response from the Language Learning Model (LLM) while also processing the response by updating the current prompt with the received message.
Streams the result of a request to a language model.
Requests an LLM (Language Model) to generate a structured output based on the provided structure. The response is post-processed to update the prompt with the raw response.
Sends a request to the LLM using the given structured data and expects a structured response in one attempt. Updates the prompt with the raw response received from the LLM.
Sends a request to the Language Model (LLM) without including any tools, processes the response, and updates the prompt with the returned message.
Rewrites the current prompt by applying a transformation function.
Sets the ai.koog.prompt.params.LLMParams.ToolChoice for this LLM session.
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Auto to make LLM automatically decide between calling tools and generating text
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM call one specific tool toolName
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM never call tools
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Required to make LLM always call tools
Transforms a flow of arguments into a flow of results by asynchronously executing the given tool in parallel.
Executes the given tool in parallel for each element in the flow of arguments, up to the specified level of concurrency.
Transforms a Flow of tool argument objects into a Flow of parallel tool execution results, using the specified tool class.
Executes a flow of tool arguments in parallel by invoking the provided tool's raw execution method. Converts each argument in the flow into a string result returned from the tool.
Converts a flow of arguments into a flow of raw string results by executing the corresponding tool calls in parallel.
Unset the ai.koog.prompt.params.LLMParams.ToolChoice. Mostly, if left unspecified, the default value of this parameter is ai.koog.prompt.params.LLMParams.ToolChoice.Auto
Updates the current prompt by applying modifications defined in the provided block. The modifications are applied using a PromptBuilder
instance, allowing for customization of the prompt's content, structure, and associated messages.