import { H as ResolvedModel, x as RuleContext } from "./types-Cm5Z7Fll.mjs"; import { GenericSchema, InferOutput } from "valibot"; import { JsonSchema } from "@valibot/to-json-schema"; import { Message } from "@xsai/shared-chat"; //#region src/structuredOutput/index.d.ts interface GenerateStructuredOptions { /** * Builds the chat messages for each attempt. On retries, `retryFeedback` * carries a ready-to-send validation-failure message; insert it wherever it * fits the conversation, usually right before the final user message. */ createMessages: (retryFeedback?: string) => Message[]; logger?: RuleContext['logger']; /** Maximum number of attempts when validation fails. Defaults to 3. */ maxAttempts?: number; metering?: RuleContext['metering']; model: ResolvedModel; /** Label recorded in metering metadata and debug logs, e.g. `go-responsibility-boundary-judge`. */ operation: string; /** Milliseconds to wait before the given (1-based) attempt is retried. */ retryDelay?: (attempt: number) => number; schema: Schema; /** Cancels the model call and any pending retry backoff. Pass `ctx.signal` from a rule. */ signal?: AbortSignal; temperature?: number; /** Shown to the model as the tool description. Defaults to the schema's valibot description. */ toolDescription?: string; toolName?: string; } declare class InvalidStructuredOutputError extends Error { constructor(message: string); } /** Standard instruction line for localized judge findings; undefined when no language is configured. */ declare function formatOutputLanguageInstruction(outputLanguage: string | undefined): string | undefined; /** Prefixes each line with its 1-based number so schemas can ask for "left-column line numbers". */ declare function formatSourceWithLineNumbers(source: string): string; /** * Forces the model to call a single reporting tool and returns the validated * tool arguments, so a tool call doubles as structured output. Unlike * `response_format`-based structured output (xsai's `generateObject`), a * forced tool call works on any provider with function calling, and invalid * payloads are retried with validation feedback instead of failing outright. */ declare function generateStructured(options: GenerateStructuredOptions): Promise>; declare function normalizeToolJsonSchema(schema: JsonSchema): JsonSchema; /** Converts a valibot schema into provider-compliant strict tool parameters. */ declare function toolParametersFromSchema(schema: GenericSchema): JsonSchema; //#endregion export { GenerateStructuredOptions, InvalidStructuredOutputError, formatOutputLanguageInstruction, formatSourceWithLineNumbers, generateStructured, normalizeToolJsonSchema, toolParametersFromSchema };