import type { AssetInput } from '../types/images.js'; import type { AudioContent, CompletionRequest, DocumentContent, ImageContent, Message, ToolDefinition } from '../types/messages.js'; import type { ToolCall } from '../types/response.js'; /** * One line naming an asset by where it lives, for a model to read and repeat back to a tool. Bytes * are never written out: an asset held in memory is named by its type and size. */ export declare function assetReference(asset: AssetInput): string; /** What an image part resolves to on the wire: base64 data, a URL, or nothing a provider can read. */ export type WireImage = { kind: 'base64'; mimeType: string; data: string; } | { kind: 'url'; url: string; } | undefined; /** Reads an image part as base64 data or a URL, whichever it holds. */ export declare function wireImage(part: ImageContent): WireImage; /** The text an image part stands for when a provider cannot receive it. */ export declare function imagePlaceholder(part: ImageContent): string; /** What a document part resolves to on the wire: base64 data, a URL, or nothing a provider can read. */ export type WireDocument = { kind: 'base64'; mimeType: string; data: string; filename: string; } | { kind: 'url'; mimeType: string; url: string; filename: string; } | undefined; /** Reads a document part as base64 data or a URL, whichever it holds. A document is a PDF unless it says otherwise. */ export declare function wireDocument(part: DocumentContent): WireDocument; /** The line a document part stands for when a provider cannot receive it. */ export declare function documentPlaceholder(part: DocumentContent): string; /** What an audio part resolves to on the wire: base64 data and its format, when it holds bytes. */ export declare function wireAudio(part: AudioContent): { data: string; format: string; } | undefined; /** The text an audio part stands for when a provider cannot hear it: its transcript, when it has one. */ export declare function audioPlaceholder(part: AudioContent): string; /** The image, audio, and document parts of a message, in order: what a tool message cannot carry on some APIs. */ export declare function mediaOf(content: Message['content']): Array; /** The tools a tool search has found so far in a conversation, by name. */ export declare function referencedTools(messages: readonly Message[]): Set; /** * The tools to send a provider without tool references: every tool that is not deferred, and each * deferred one a tool search has found. The request's own list when nothing is deferred. */ export declare function offeredTools(request: CompletionRequest): ToolDefinition[] | undefined; /** A message's text, with asset parts as references and other media left out. */ export declare function textOf(content: Message['content']): string; /** The image parts of a message, in order. */ export declare function imagesOf(content: Message['content']): ImageContent[]; /** Parses a tool call's arguments for a provider that wants an object, keeping malformed JSON as text. */ export declare function toolArguments(call: ToolCall): Record; /** The name of the tool a result answers, found from the assistant message that called it. */ export declare function toolNameFor(messages: Message[], index: number): string | undefined;