import { Message } from "../chat/Message.js"; import { ToolDefinition, ToolCall } from "../chat/Tool.js"; export interface ResponseFormat { type: "text" | "json_object" | "json_schema"; json_schema?: { name: string; description?: string; strict?: boolean; schema?: Record; [key: string]: unknown; }; [key: string]: unknown; } import { ContentPart } from "../chat/Content.js"; export interface ThinkingConfig { /** * Effort level for thinking-capable models. * 'low', 'medium', 'high' map to provider-specific qualitative settings. * 'none' disables thinking if the model allows it. */ effort?: "low" | "medium" | "high" | "none"; /** * Maximum budget (in tokens) dedicated to thinking. */ budget?: number; } export interface ThinkingResult { /** * The thinking text (chain of thought). */ text?: string; /** * Cryptographic signature or provider-specific trace ID. */ signature?: string; /** * Tokens consumed during thinking. */ tokens?: number; } export type ToolChoice = "auto" | "none" | "required" | { type: "function"; function: { name: string; }; } | string; export interface ChatRequest { model: string; messages: Message[]; tools?: ToolDefinition[]; tool_choice?: ToolChoice; parallel_tool_calls?: boolean; thinking?: ThinkingConfig; temperature?: number; max_tokens?: number; response_format?: ResponseFormat; prediction?: string | ContentPart[]; headers?: Record; requestTimeout?: number; [key: string]: unknown; } export interface ChatChunk { content: string; thinking?: ThinkingResult; /** @deprecated use thinking.text */ reasoning?: string; tool_calls?: ToolCall[]; done?: boolean; usage?: Usage; finish_reason?: string | null; metadata?: Record; } export interface Usage { input_tokens: number; output_tokens: number; total_tokens: number; reasoning_tokens?: number; image_tokens?: number; cached_tokens?: number; cache_creation_tokens?: number; cost?: number; input_cost?: number; output_cost?: number; } export interface Attachment { mimeType: string; data: string; name?: string; [key: string]: unknown; } export interface ChatResponse { content: string | null; thinking?: ThinkingResult; /** @deprecated use thinking.text */ reasoning?: string | null; tool_calls?: ToolCall[]; usage?: Usage; finish_reason?: string | null; metadata?: Record; attachments?: Attachment[]; } export interface ProviderCapabilities { supportsVision(modelId: string): boolean; supportsTools(modelId: string): boolean; supportsStructuredOutput(modelId: string): boolean; supportsEmbeddings(modelId: string): boolean; supportsImageGeneration(modelId: string): boolean; supportsTranscription(modelId: string): boolean; supportsModeration(modelId: string): boolean; supportsReasoning(modelId: string): boolean; supportsDeveloperRole(modelId: string): boolean; supportsPrediction?(modelId: string): boolean; supportsToolChoice?(modelId: string): boolean; getContextWindow(modelId: string): number | null; } export interface ModelInfo { id: string; name: string; provider: string; family: string; context_window: number | null; max_output_tokens: number | null; modalities: { input: string[]; output: string[]; }; capabilities: string[]; pricing: unknown; metadata?: Record; } export interface ImageRequest { model?: string; prompt: string; images?: string[]; mask?: string; size?: string; quality?: string; n?: number; headers?: Record; requestTimeout?: number; [key: string]: unknown; } export interface ImageResponse { url?: string; data?: string; mime_type?: string; revised_prompt?: string; } export interface TranscriptionRequest { model?: string; file: string; prompt?: string; language?: string; speakerNames?: string[]; speakerReferences?: string[]; requestTimeout?: number; /** * Granularity of timestamps in the response. * 'word' returns word-level timestamps (useful for subtitle generation). * Defaults to 'segment' if not specified. */ timestamp_granularities?: ("word" | "segment")[]; } export interface TranscriptionWord { word: string; start: number; end: number; } export interface TranscriptionSegment { id: number; start: number; end: number; text: string; speaker?: string; words?: TranscriptionWord[]; [key: string]: unknown; } export interface TranscriptionResponse { text: string; model: string; duration?: number; segments?: TranscriptionSegment[]; words?: TranscriptionWord[]; } export interface ModerationRequest { input: string | string[]; model?: string; requestTimeout?: number; } export interface ModerationResult { flagged: boolean; categories: Record; category_scores: Record; } export interface ModerationResponse { id: string; model: string; results: ModerationResult[]; } export interface EmbeddingRequest { input: string | string[]; model?: string; dimensions?: number; user?: string; requestTimeout?: number; } export interface EmbeddingVector { embedding: number[]; index: number; } export interface EmbeddingResponse { vectors: number[][]; model: string; input_tokens: number; dimensions: number; } export interface Provider { id: string; chat(request: ChatRequest): Promise; stream?(request: ChatRequest): AsyncIterable; listModels?(): Promise; paint?(request: ImageRequest): Promise; transcribe?(request: TranscriptionRequest): Promise; moderate?(request: ModerationRequest): Promise; embed?(request: EmbeddingRequest): Promise; defaultModel(feature?: string): string; capabilities?: ProviderCapabilities; formatToolResultMessage(toolCallId: string, content: string, options?: { isError?: boolean; }): Message; } //# sourceMappingURL=Provider.d.ts.map