import { ErrorCategory } from "./error-category.type.mjs"; import { AIErrorOptions } from "./ai-error.mjs"; import { ProviderError } from "./provider-error.mjs"; //#region ../ai/src/errors/context-length-exceeded-error.d.ts /** * Payload for `ContextLengthExceededError`. All fields are optional — * providers inconsistently surface exact token counts and the * model's limit. When present, they let callers compute a trim * target; when absent, the error still categorizes the failure. */ type ContextLengthExceededErrorOptions = AIErrorOptions & { limit?: number; actual?: number; modelName?: string; }; /** * The request's prompt (messages + tools + schema) exceeded the * model's context window. Not retryable without shortening the input. * * Typically surfaced as OpenAI 400 with `code: "context_length_exceeded"`. * * @example * if (result.error instanceof ContextLengthExceededError) { * messages = truncateOldestTurns(messages); * return agent.execute(input, { history: messages }); * } */ declare class ContextLengthExceededError extends ProviderError { static readonly defaultCategory: ErrorCategory; readonly limit?: number; readonly actual?: number; readonly modelName?: string; constructor(message: string, options?: ContextLengthExceededErrorOptions); } //#endregion export { ContextLengthExceededError, ContextLengthExceededErrorOptions }; //# sourceMappingURL=context-length-exceeded-error.d.mts.map