/** * Chat completion and embedding functions using the OpenAI API. * * Extracted from openai.ts to keep that module focused on * voice / vision services while this module handles text-level * AI calls (chat completions, embeddings, cosine similarity). */ export interface ChatMessage { role: "system" | "user" | "assistant"; content: string; } /** * Lightweight chat completion using GPT-4o-mini. * Used for context preprocessing, not for agent dialogue. * Returns the assistant's text response. * Retries on 429/5xx with exponential backoff (up to 3 attempts). */ export declare function chatCompletion(messages: ChatMessage[], apiKey: string, options?: { maxTokens?: number; temperature?: number; timeoutMs?: number; model?: string; responseFormat?: { type: string; }; /** Usage-meter bucket for this call (defaults to "chat"). */ category?: string; /** Originating thread, for usage attribution. */ threadId?: number; }): Promise; /** * Generate an embedding vector for text using OpenAI's text-embedding-3-small model. * Returns a Float32Array of 1536 dimensions. * * @param threadId Originating thread, when known — used for usage attribution only. */ export declare function generateEmbedding(text: string, apiKey: string, threadId?: number): Promise; /** Compute cosine similarity between two embedding vectors. Returns value in [-1, 1]. */ export declare function cosineSimilarity(a: Float32Array, b: Float32Array): number; //# sourceMappingURL=chat.d.ts.map