import type { BuiltInModelProviderId, BuiltInToolsConfig, ReasoningConfig } from "@b4run/sdk"; type Importer = (specifier: string) => Promise>; /** Provider → the package that ships its chat model class. */ export declare const providerPackages: Readonly>; /** Install the process-wide fallback importer. Last call wins. */ export declare function seedModelImporter(importer: Importer): void; /** Advisory once-per-process warning; never blocks model construction. */ export declare function warnOnUnknownModelId(opts: { readonly model: string; readonly provider: string; }): void; /** * The install command for the package manager that launched this process. * npm, pnpm, yarn and bun all set `npm_config_user_agent` (read through * `readRuntimeEnv`, so this stays edge-safe); npm is the default * because that is what `npm create b4-app` scaffolds. */ export declare function installCommand(packageName: string, userAgent: string | undefined): string; export declare function missingProviderPackageMessage(provider: BuiltInModelProviderId, packageName: string, userAgent?: string): string; /** * A JSON Schema the model's final text message must conform to, applied as the * provider's native schema-constrained output mode. Sent by AG-UI clients that * render the assistant's reply, as `forwardedProps.responseSchema`, and * bound on the ROOT model only: subagents, summarization and the memory * extractor construct their own models and never see it. */ export interface JsonSchemaResponseFormat { readonly type: "json_schema"; /** Provider-facing schema name (OpenAI requires one; `^[a-zA-Z0-9_-]{1,64}$`). */ readonly name: string; readonly schema: Readonly>; } /** * Providers whose chat model accepts a JSON-schema output format ALONGSIDE * bound tools, so an agent loop can keep calling tools and still have its * final message constrained: * * - `openai`: `response_format: { type: "json_schema", ... }` is a call * option `@langchain/openai` forwards on both the Chat Completions and * Responses paths, and the API accepts it together with `tools` — a turn * that calls tools returns tool calls, a turn that answers returns JSON. * - `anthropic`: `outputConfig.format = { type: "json_schema", ... }` is the * call option `withStructuredOutput({ method: "jsonSchema" })` itself binds. * * Every other provider is REJECTED when a response format is requested rather * than silently run unconstrained: from the client's side an ignored schema * and an honored one look identical until a reply fails to parse. Gemini in * particular refuses `responseSchema` combined with function declarations, * and the OpenAI-compatible gateways (`xai`, `openrouter`, `groq`) honor * `response_format` only for some upstream models, which is exactly the * silent no-op this exists to prevent. */ export declare const JSON_SCHEMA_RESPONSE_FORMAT_PROVIDERS: readonly BuiltInModelProviderId[]; export declare function supportsJsonSchemaResponseFormat(provider: BuiltInModelProviderId): boolean; export declare function unsupportedResponseFormatMessage(provider: BuiltInModelProviderId): string; /** * What a route's model can take, as a content part: the one judgment behind * both the run-time drop decision (`toLangChainContent`) and the capability * document, once sub-project 3's PR 2 adds the `multimodal` section. Read off LangChain's per-model `profile` * (`@langchain/core` `ModelProfile`), every flag defaulting to `false`; a * model with no profile — every `ollama` and `mistral` model, an unknown id * elsewhere — falls back to a conservative per-provider table. `file` is a * provider fact, not a profile one: whether its converter maps a `fileId`. * Provider overrides (converter limits the profile does not know about) apply * after the profile, on both the profile and the fallback path. */ export interface ModalitySupport { readonly image: { readonly data: boolean; readonly url: boolean; }; readonly pdf: { readonly data: boolean; readonly url: boolean; }; readonly audio: boolean; readonly video: boolean; readonly toolResult: { readonly image: boolean; readonly pdf: boolean; }; /** Which part types this provider's converter maps a provider file handle (`fileId`) for. */ readonly file: { readonly image: boolean; readonly pdf: boolean; }; } /** * Images inline or by URL, and nothing else. This is what every provider's * converter handles only together with the conversion module's mapping: * the `ollama` and `mistral` converters accept just the legacy `image_url` * block, and `toLangChainContent` emits that for them. */ export declare const DEFAULT_MODALITY_SUPPORT: ModalitySupport; export declare function resolveModalitySupport(model: unknown, provider: BuiltInModelProviderId): ModalitySupport; /** * A model's LangChain `profile` read off its class, without constructing it: * every provider package's `profile` getter is a static per-id table that * reads only `this.model` (verified against the installed openai, anthropic, * google, groq, xai and openrouter packages; `@langchain/core`'s base * getter returns `{}`), and most constructors throw without a credential, * which a capability document must not depend on. `undefined` when the * provider package is not installed (the route could not run either) — the * caller advertises nothing rather than guessing. A class without its own * getter (`ollama`, `mistral`) yields an empty profile, so the provider * fallback applies, exactly as at run time. */ export declare function readModelProfile(options: { readonly provider: BuiltInModelProviderId; readonly model: string; readonly importer?: Importer; }): Promise<{ readonly model: string; readonly profile: unknown; } | undefined>; /** Remove only the standalone tool binding so createAgent can bind all tools together. */ export declare function modelForAgent(model: unknown): unknown; /** Construct a provider chat model with validated reasoning, built-ins, and response constraints. */ export declare function createChatModel(options: { readonly model: string; readonly provider: BuiltInModelProviderId; /** Positive safe integer output budget for each provider call, when configured. */ readonly maxOutputTokens?: number; /** Provider-managed tools, bound on every invocation of the returned model. */ readonly builtInTools?: BuiltInToolsConfig; readonly reasoning?: ReasoningConfig; readonly importer?: Importer; /** * When set, the returned model is bound so its final message must match * the schema; see {@link JSON_SCHEMA_RESPONSE_FORMAT_PROVIDERS} for which * providers can. Any other provider rejects BEFORE its package is imported. */ readonly responseFormat?: JsonSchemaResponseFormat; /** * The chat model's `maxRetries`: how many times LangChain's `AsyncCaller` * re-sends one failed request. Agent routes pass `retry.maxAttempts - 1`; * left unset, the provider package's own default applies (6). */ readonly maxRetries?: number; }): Promise; export {}; //# sourceMappingURL=chat-model-factory.d.ts.map