Package-level declarations

Types

Link copied to clipboard
class LLMBasedToolCallFixProcessor(toolRegistry: ToolRegistry, toolCallJsonConfig: ToolCallJsonConfig = ToolCallJsonConfig(), preprocessor: ResponseProcessor = ManualToolCallFixProcessor(toolRegistry, toolCallJsonConfig), fallbackProcessor: ResponseProcessor? = null, assessToolCallIntentSystemMessage: String = Prompts.assessToolCallIntent, fixToolCallSystemMessage: String = Prompts.fixToolCall, invalidJsonFeedback: (List<ToolDescriptor>) -> String = Prompts::invalidJsonFeedback, invalidNameFeedback: (String, List<ToolDescriptor>) -> String = Prompts::invalidNameFeedback, invalidArgumentsFeedback: (String, ToolDescriptor) -> String = Prompts::invalidArgumentsFeedback, maxRetries: Int = 3) : ToolJsonFixProcessor

A response processor that fixes incorrectly communicated tool calls.

Link copied to clipboard
class ManualToolCallFixProcessor(toolRegistry: ToolRegistry, toolCallJsonConfig: ToolCallJsonConfig = ToolCallJsonConfig()) : ToolJsonFixProcessor

A response processor that fixes invalid tool call jsons. Fixes incorrectly formatted jsons, e.g.

Link copied to clipboard
abstract class ResponseProcessor

A processor for handling and modifying LLM responses.

Link copied to clipboard
class ToolCallJsonConfig(val json: Json = defaultJson, val idJsonKeys: List<String> = defaultIdJsonKeys, val nameJsonKeys: List<String> = defaultNameJsonKeys, val argsJsonKeys: List<String> = defaultArgsJsonKeys)

Configuration for parsing and fixing tool call json

Link copied to clipboard
abstract class ToolJsonFixProcessor(toolRegistry: ToolRegistry, toolCallJsonConfig: ToolCallJsonConfig = ToolCallJsonConfig()) : ResponseProcessor

Abstract class for processors that fix tool call json messages. Contains common logic for extracting relevant information from (possibly malformed) tool call json messages.

Functions

Link copied to clipboard
suspend fun PromptExecutor.executeProcessed(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, responseProcessor: ResponseProcessor? = null): List<Message.Response>

Executes the given prompt and processes responses using the given responseProcessor.