/** * OpenAI Request Config Resolution * * Pulled out of openai.ts as a pure function so it can be unit tested * without touching `fetch` - several route tests `mock.module()` the whole * `./openai` module (Bun's module mocks are process-global and permanent * for the test run, not scoped to the file that set them - see those tests' * own comments), which would make a test importing the real `callOpenAI` * from that same specifier flaky depending on file execution order. */ import type { ProcessingConfig } from "../../types"; export declare const DEFAULT_OPENAI_API_URL = "https://api.openai.com/v1/chat/completions"; /** * A single call's default. `processCall`/`processMessage` make up to two of * these sequentially (processIncoming, then processOutgoing, with a chat() * turn between them) inside one Twilio webhook, which must return within * ~15s - an 8s-per-call default would let two hangs alone exceed that, so * this is deliberately well under half the budget. */ export declare const DEFAULT_OPENAI_REQUEST_TIMEOUT_MS = 5000; /** * Default sampling temperature for the pre/post-processing pipeline's * structured, single-answer tasks (language detection, transfer/end-call * intent, message cleanup) - low enough to keep those deterministic without * pinning to 0. */ export declare const DEFAULT_PROCESSING_TEMPERATURE = 0.3; export declare function resolveOpenAIRequestConfig(processing?: ProcessingConfig): { apiUrl: string; timeoutMs: number; temperature: number; }; export interface ChatCompletionRequestBody { model: string; messages: Array<{ role: "system" | "user"; content: string; }>; temperature: number; } /** * Pure request-body assembly, split out of `callOpenAI` (`./openai.ts`) for * the same reason `resolveOpenAIRequestConfig` is: that specifier is * `mock.module()`d process-wide by several route tests, which would make a * test against the real function flaky depending on file execution order. * A distinct specifier that nothing else mocks stays directly testable, so * this is where `temperature` actually reaching the request body is proven. */ export declare function buildChatRequestBody(model: string, systemPrompt: string, userMessage: string, temperature: number): ChatCompletionRequestBody;