UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

56 lines • 2.63 kB
/** * UnsupportedThinkingError — a thinking request the provider/model pair cannot honor, * refused by name BEFORE anything is sent. * * Models on one wire disagree about thinking (see `ThinkingMode`), and the * vendor's answer to the wrong shape is an HTTP 400 on every call — one that * names the vendor's field, not the library setting that produced it. So the * refusal happens here instead, with the fix in the message: * * - at `Agent.build()`, when the provider DECLARES (`LLMProvider.thinkingMode`) * that thinking is unsupported for a model the agent will call (`reason: 'no-thinking'`); * - in the adapter, before the request leaves, for a model chosen at run time * and for the combinations the wire rejects whenever thinking is on * (`'budget'`, `'temperature'`, `'forced-tool-choice'`). * * `retryable: false` — asking again sends the same request — so `withRetry`'s * default policy never retries it; `withFallback` does not move the call to * its other side and `withCircuitBreaker` does not count it, by default — * the request is wrong, not the vendor. * * @example * ```ts * import { UnsupportedThinkingError } from 'agentfootprint/providers'; * * try { * agent = Agent.create({ provider, model }).thinking({ budget: 4000 }).build(); * } catch (err) { * if (err instanceof UnsupportedThinkingError) console.error(err.model, err.reason); * } * ``` */ export declare class UnsupportedThinkingError extends Error { /** The provider that answered for the model — `'anthropic'`, `'browser-anthropic'`, … */ readonly provider: string; /** The model the request named. */ readonly model: string; /** * Why the request cannot be sent: * - `'no-thinking'` — thinking is unsupported by the provider/model pair; * - `'budget'` — the budget is not one the model's `budget_tokens` accepts; * - `'temperature'` — a temperature other than the default, which the wire * rejects while thinking is on; * - `'forced-tool-choice'` — a forced tool choice, which budget thinking rejects. */ readonly reason: 'no-thinking' | 'budget' | 'temperature' | 'forced-tool-choice'; /** Asking again cannot mend it — read by `withRetry`'s default predicate. */ readonly retryable = false; constructor(args: { readonly provider: string; readonly model: string; readonly reason: UnsupportedThinkingError['reason']; /** The sentence after `thinking on '<model>':` — what is wrong and the fix. */ readonly detail: string; }); } //# sourceMappingURL=errors.d.ts.map