import type { LanguageModelV3CallOptions, LanguageModelV3ToolResultOutput, LanguageModelV3Usage, SharedV3Warning } from '@ai-sdk/provider'; import { type LLMMessage } from '../types'; /** * On-device runtimes report no token counts, so every usage field is * `undefined` (the shape the spec prescribes for "unknown"). */ export declare const EMPTY_USAGE: LanguageModelV3Usage; /** Unique-enough id for stream parts / tool calls within a session. */ export declare function newPartId(prefix: string): string; /** Everything doGenerate/doStream needs, derived from LanguageModelV3CallOptions. */ export type ConvertedCall = { /** The conversation in our core protocol, instructions merged into the system message. */ messages: LLMMessage[]; /** Names of function tools offered to the model ([] when none / toolChoice 'none'). */ toolNames: string[]; /** True when responseFormat is JSON — output should be extracted as JSON. */ jsonMode: boolean; /** Spec warnings for settings we cannot honor on-device. */ warnings: SharedV3Warning[]; }; /** * Map the AI SDK's call options onto our core `LLMMessage[]` protocol. * * - System messages are merged into one leading system message, with the tool * instruction (tools.ts) and/or JSON-Schema instruction (structured.ts) * appended — the same prompt protocol as generateText / generateObject. * - Assistant tool-call parts are re-rendered as the `{"tool", "arguments"}` * envelope and tool results as formatToolResult() text, so multi-step AI SDK * conversations round-trip through the exact format the model was taught. * - Per-call sampling settings can't be honored (fixed at setModel) and are * reported as spec warnings instead of being silently dropped. * * @throws {ModelError} DEVICE_NOT_SUPPORTED on file/image prompt parts — * on-device text models have no media input (vision is on the roadmap). */ export declare function convertCallOptions(options: LanguageModelV3CallOptions): ConvertedCall; /** What the model's raw text turned out to be, per the offered capabilities. */ export type ExtractedOutput = { kind: 'text'; text: string; } | { kind: 'tool-call'; toolName: string; input: string; }; /** * Interpret raw model output for the AI SDK: detect a tool-call envelope when * tools were offered (reusing parseToolCall), or extract/clean the JSON value * in json mode (reusing extractJson). Single-shot — the repair loops live in * the core generateText/generateObject, not in the provider. */ export declare function extractOutput(text: string, toolNames: string[], jsonMode: boolean): ExtractedOutput; /** Unwrap the spec's tool-result output union into a plain value for formatToolResult. */ export declare function unwrapToolOutput(output: LanguageModelV3ToolResultOutput): unknown; //# sourceMappingURL=convert.d.ts.map