LLMBasedToolCallFixProcessor
constructor(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)(source)
Parameters
toolRegistry
The tool registry with available tools
toolCallJsonConfig
Configuration for parsing and fixing tool call json
preprocessor
A processor applied to all responses from the LLM. Defaults to ManualToolCallFixProcessor
assessToolCallIntentSystemMessage
The system message to ask LLM if a tool call was intended
fixToolCallSystemMessage
The system message to ask LLM to fix a tool call
invalidJsonFeedback
The message sent to the LLM when tool call json is invalid
invalidNameFeedback
The message sent to the LLM when the tool name is invalid
invalidArgumentsFeedback
The message sent to the LLM when tool arguments are invalid
fallbackProcessor
The fallback processor to use if LLM fails to fix a tool call. Defaults to null, meaning that the original message is returned if the LLM fails to fix a tool call.
maxRetries
The maximum number of iterations in the main loop