import { Middleware, MiddlewareContext, RequestDirective } from "../types/Middleware.js"; import { ChatResponseString } from "../chat/ChatResponse.js"; import { ToolCall } from "../chat/Tool.js"; export interface SchemaSelfCorrectionOptions { /** * Maximum number of correction attempts. * Default is 2. */ maxRetries?: number; } /** * Middleware that automatically detects schema validation errors in structured outputs * and re-prompts the model with specific feedback. */ export declare class SchemaSelfCorrectionMiddleware implements Middleware { readonly name = "SchemaSelfCorrection"; private readonly maxRetries; constructor(options?: SchemaSelfCorrectionOptions); onResponse(ctx: MiddlewareContext, result: ChatResponseString): Promise; onToolCallError(ctx: MiddlewareContext, toolCall: ToolCall, error: unknown): Promise<"CONTINUE" | "STOP" | "RETRY">; } /** * Factory function for creating the self-correction middleware. */ export declare function SchemaSelfCorrection(options?: SchemaSelfCorrectionOptions): SchemaSelfCorrectionMiddleware; //# sourceMappingURL=SchemaSelfCorrection.d.ts.map