UNPKG

@aituber-onair/core

Version:

Core library for AITuber OnAir providing voice synthesis and chat processing

40 lines (39 loc) 1.6 kB
import { ChatService } from './ChatService'; import { Message, MessageWithVision } from '../../types'; /** * OpenAI implementation of ChatService */ export declare class OpenAIChatService implements ChatService { private apiKey; private model; private visionModel; /** Provider name */ readonly provider: string; /** * Constructor * @param apiKey OpenAI API key * @param model Name of the model to use * @param visionModel Name of the vision model */ constructor(apiKey: string, model?: string, visionModel?: string); /** * Get the current model name * @returns Model name */ getModel(): string; /** * Process chat messages * @param messages Array of messages to send * @param onPartialResponse Callback to receive each part of streaming response * @param onCompleteResponse Callback to execute when response is complete */ processChat(messages: Message[], onPartialResponse: (text: string) => void, onCompleteResponse: (text: string) => Promise<void>): Promise<void>; /** * Process chat messages with images * @param messages Array of messages to send (including images) * @param onPartialResponse Callback to receive each part of streaming response * @param onCompleteResponse Callback to execute when response is complete * @throws Error if the selected model doesn't support vision */ processVisionChat(messages: MessageWithVision[], onPartialResponse: (text: string) => void, onCompleteResponse: (text: string) => Promise<void>): Promise<void>; }