Properties

Link copied to clipboard
abstract val config: AIAgentConfig

Config of the agent running the session.

Link copied to clipboard
abstract val model: LLModel

Represents the active language model used within the session.

Link copied to clipboard
abstract val prompt: Prompt

Represents the current prompt associated with the LLM session. The prompt contains the input messages, model configuration, and parameters.

Link copied to clipboard

Represents the active response processor within the session. The processor defines the post-processing of messages returned from the LLM.

Link copied to clipboard
abstract val tools: List<ToolDescriptor>

Provides a list of tools based on the current active state. This property holds a collection of ToolDescriptor instances, which describe the tools available for use.

Functions

Link copied to clipboard
abstract override fun close()
Link copied to clipboard

Parses a structured response from the language model using the specified configuration.

Link copied to clipboard
abstract suspend fun requestLLM(): Message.Response

Sends a request to the underlying LLM and returns the first response. This method ensures the session is active before executing the request.

Link copied to clipboard
abstract suspend fun requestLLMForceOneTool(tool: Tool<*, *>): Message.Response

Sends a request to the language model while enforcing the use of a specific tool, and returns the response.

Link copied to clipboard
abstract suspend fun requestLLMMultiple(): List<Message.Response>

Sends a request to the language model, potentially utilizing multiple tools, and returns a list of responses from the model.

Link copied to clipboard
abstract suspend fun requestLLMMultipleChoices(): List<LLMChoice>

Sends a request to the language model, potentially receiving multiple choices, and returns a list of choices from the model.

Link copied to clipboard

Sends a request to the language model that enforces the usage of tools and retrieves all responses.

Link copied to clipboard

Sends a request to the language model without utilizing any tools and returns multiple responses.

Link copied to clipboard

Sends a request to the language model that enforces the usage of tools and retrieves the response.

Link copied to clipboard
abstract suspend fun requestLLMStreaming(): Flow<StreamFrame>

Sends a streaming request to the underlying LLM and returns the streamed response. This method ensures the session is active before executing the request.

Link copied to clipboard
abstract suspend fun <T> requestLLMStructured(config: StructuredRequestConfig<T>, fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>
abstract suspend fun <T> requestLLMStructured(serializer: KSerializer<T>, examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>

Sends a request to LLM and gets a structured response.

Link copied to clipboard

Sends a request to the language model without utilizing any tools and returns the response.

Link copied to clipboard
abstract suspend fun requestModeration(moderatingModel: LLModel? = null): ModerationResult

Sends a moderation request to the specified or default large language model (LLM) for content moderation.