AutoCorrectionPolicy

class AutoCorrectionPolicy(maxRetries: Int = DEFAULT_MAX_RETRIES, minFuzzyLength: Int = DEFAULT_MIN_FUZZY_LENGTH) : ToolNotFoundPolicy

Feeds the error back to the LLM with a fuzzy-match suggestion, allowing it to self-correct. Matches tool names using case-insensitive containment (either direction). Throws ToolNotFoundException after maxRetries consecutive failures.

Constructors

Link copied to clipboard
constructor(maxRetries: Int = DEFAULT_MAX_RETRIES, minFuzzyLength: Int = DEFAULT_MIN_FUZZY_LENGTH)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun handle(requestedName: String, availableTools: List<Tool>): ToolNotFoundAction

Handle a tool-not-found event.

Link copied to clipboard
open override fun onToolFound()

Called when a tool is found successfully, allowing stateful policies to reset internal counters.