import { RealtimeProvider, RealtimeProviderConfig, RealtimeProviderCallbacks, RealtimeMessage, AudioFormat } from './RealtimeProvider'; import { OpenAICompatibleProviderType, ProviderType } from '../types/providers'; /** * Provider-specific configuration * Defines base URLs and voice mappings for OpenAI * Currently unused but kept for potential future use */ /** * OpenAI Realtime API Provider * Uses the official @openai/agents-realtime SDK * Handles WebRTC transport, authentication, and audio via the SDK * * Note: The SDK automatically handles audio capture and streaming via WebRTC, * so sendAudio() is a no-op for this provider. */ export declare class OpenAIRealtimeProvider extends RealtimeProvider { private agent; private session; private isConnected; /** * Store original agent config to recreate agents with updated instructions * This preserves tools, name, and other settings when updating context */ private originalAgentConfig; /** * Map to store pending tool execution promises * OpenAI SDK calls execute() directly, so we use this to bridge * with our async callback system */ private pendingToolExecutions; /** Provider type for logging and getProviderId (openai or grok) */ private providerType; /** * Constructor * @param config - Provider configuration * @param callbacks - Event callbacks * @param providerType - Provider type ("openai" | "grok") for OpenAI-compatible APIs */ constructor(config: RealtimeProviderConfig, callbacks: RealtimeProviderCallbacks, providerType?: OpenAICompatibleProviderType); /** * Get audio format for OpenAI (24kHz PCM16) * NOTE: OpenAI SDK handles audio end-to-end via WebRTC, so AudioManager is not used */ getAudioFormat(): AudioFormat; /** * Check if this provider handles audio internally * OpenAI SDK uses WebRTC and manages audio end-to-end */ handlesAudioInternally(): boolean; connect(): Promise; /** * Set up event listeners for the OpenAI Realtime Session */ private setupEventListeners; /** * Normalize provider-specific message to common format * NOTE: For OpenAI, event normalization is handled by setupEventListeners() * The SDK provides pre-normalized events via session.on() callbacks * This method is required by the abstract base class but not actively used * for OpenAI's event-driven pattern */ protected normalizeMessage(_rawMessage: any): RealtimeMessage | null; /** * Create SDK Tool instances from Vowel tool definitions * Uses the OpenAI SDK's tool() factory to create proper Tool objects * * IMPORTANT: OpenAI SDK calls execute() directly and expects the return value * to be the tool result. This is different from Gemini's event-based pattern. * We trigger our callback system AND return the result for OpenAI's pattern. */ private createSDKTools; /** * Convert VowelAction parameter definitions to Zod schema * Maps Vowel's parameter types to equivalent Zod validators */ private convertVowelActionToZod; disconnect(): Promise; sendAudio(_audioData: string, _format?: AudioFormat): void; /** * Send text input to OpenAI * * Uses RealtimeSession.sendMessage() to send text content to the AI. * This is useful for notifyEvent() calls or programmatic text input. */ sendText(text: string): void; /** * Send image input to OpenAI * * Uses RealtimeSession.addImage() to send image content to the AI. * Supports both URLs and data URIs. * * @param imageUrl - URL or data URI of the image (e.g., "https://..." or "data:image/png;base64,...") */ sendImage(imageUrl: string): void; interrupt(): void; sendToolResponse(toolCallId: string, toolName: string, response: any): void; updateConfig(config: Partial): void; /** * Update session agent with new instructions using session.updateAgent() * This is the recommended pattern for OpenAI Agents SDK - creates a new agent * with updated instructions and updates the session. * * Note: updateAgent() is async, so we handle it with fire-and-forget pattern * to maintain compatibility with the base class signature. * * @param updates - Session configuration updates (e.g., instructions) */ sendSessionUpdate(updates: { instructions?: string; }): void; /** * Internal async method to update the agent * Separated to handle the async updateAgent() call properly */ private updateAgentAsync; getProviderId(): ProviderType; isSessionActive(): boolean; } //# sourceMappingURL=OpenAIRealtimeProvider.d.ts.map