import { isNumberArray } from "./runtime-loader/provider-embedding-responses.js"; import { mergeUsage, readGatewayBillingMode, type RuntimeUsage } from "./runtime-loader/provider-usage.js"; import type { ProviderKind } from "./runtime-loader/provider-http.js"; import type { ModelRuntimePromptMessage, ModelRuntimeToolDefinition } from "./types.js"; import { buildProviderError, DEFAULT_PROVIDER_STREAM_HEADERS_TIMEOUT_MS, DEFAULT_PROVIDER_STREAM_TOTAL_HEADERS_BUDGET_MS, parseRetryAfterMs, requestJson, requestStream, waitForProviderStreamRetry } from "./runtime-loader/provider-http.js"; import { readRecord } from "./runtime-loader/provider-records.js"; import { TOOL_INPUT_PENDING_THRESHOLD_MS, withToolInputStatusTransitions } from "./runtime-loader/tool-input-status.js"; export { jsonValuesEqual, snapshotJsonValue, snapshotProviderJsonValue, } from "./runtime-loader/json-snapshot.js"; export type { JsonSnapshotOptions, JsonSnapshotValue } from "./runtime-loader/json-snapshot.js"; export { ProviderError, ProviderOverloadedError, ProviderQuotaError, ProviderRateLimitError, ProviderRequestError, } from "./runtime-loader/provider-http.js"; export { TOOL_INPUT_PENDING_THRESHOLD_MS, withToolInputStatusTransitions }; export { buildProviderError, DEFAULT_PROVIDER_STREAM_HEADERS_TIMEOUT_MS, DEFAULT_PROVIDER_STREAM_TOTAL_HEADERS_BUDGET_MS, isNumberArray, mergeUsage, parseRetryAfterMs, readGatewayBillingMode, readRecord, requestJson, requestStream, waitForProviderStreamRetry, }; export type { RuntimePromptMessage } from "./types.js"; export type { RuntimeUsage }; /** Message shape for OpenAI-compatible chat requests. */ export type OpenAICompatibleChatMessage = { role: "system"; content: string; } | { role: "user"; content: string | Array<{ type: "text"; text: string; } | { type: "image_url"; image_url: { url: string; }; }>; } | { role: "assistant"; content: string | null; tool_calls?: Array<{ id: string; type: "function"; function: { name: string; arguments: string; }; }>; } | { role: "tool"; tool_call_id: string; content: string; }; /** Request payload for OpenAI-compatible chat completion providers. */ export type OpenAICompatibleChatRequest = { model: string; messages: OpenAICompatibleChatMessage[]; stream?: boolean; stream_options?: { include_usage?: boolean; }; max_tokens?: number; max_completion_tokens?: number; temperature?: number; top_p?: number; stop?: string[]; tools?: Array<{ type: "function"; function: { name: string; parameters: unknown; description?: string; }; }>; tool_choice?: unknown; seed?: number; presence_penalty?: number; frequency_penalty?: number; [key: string]: unknown; }; /** * Structured warning emitted when a provider runtime drops or rewrites a * caller-provided option. Mirrors the AI ecosystem convention (Vercel AI * SDK, LangChain) of returning `unsupported-setting` warnings on the * runtime result so callers can discover silently-dropped fields without * having to read the source. */ export type ProviderWarning = { type: "unsupported-setting" | "other"; setting?: string; details?: string; provider: ProviderKind; }; /** * Mutable warning collector handed to per-provider request builders so * they can append entries during the build pass instead of plumbing a * return-tuple shape through every helper. */ type WarningCollector = { push(warning: ProviderWarning): void; drain(): ProviderWarning[]; }; /** Create warning collector. */ export declare function createWarningCollector(): WarningCollector; /** Serialize a JSON-compatible value. */ export declare function stringifyJsonValue(value: unknown): string; /** Preserve provider-native argument text while serializing structured tool inputs. */ export declare function stringifyToolArguments(value: unknown): string; /** Preserve text tool results while serializing structured tool results. */ export declare function stringifyToolResultValue(value: unknown): string; /** Read text content parts from provider messages. */ export declare function readTextParts(parts: readonly { type: string; text?: string; }[]): string; /** * Convert runtime prompt messages into OpenAI-compatible chat messages. * Adjacent non-empty system layers become one ordered instruction so strict * Chat Completions providers receive a compatible message sequence. */ export declare function toOpenAICompatibleMessages(prompt: readonly ModelRuntimePromptMessage[]): OpenAICompatibleChatMessage[]; /** Convert runtime tool definitions into OpenAI-compatible function tools. */ export declare function toOpenAICompatibleTools(tools: readonly ModelRuntimeToolDefinition[] | undefined): OpenAICompatibleChatRequest["tools"] | undefined; /** Options accepted by read provider. */ export declare function readProviderOptions(providerOptions: Record | undefined, ...providerNames: string[]): Record; /** Zod schema for unwrap tool input. */ export declare function unwrapToolInputSchema(inputSchema: unknown): unknown; //# sourceMappingURL=runtime-loader.d.ts.map