@aituber-onair/core
Version:
Core library for AITuber OnAir providing voice synthesis and chat processing
69 lines (68 loc) • 2.47 kB
TypeScript
import { ChatService } from '../../ChatService';
import { Message, MessageWithVision } from '../../../../types';
/**
* Gemini implementation of ChatService
*/
export declare class GeminiChatService implements ChatService {
private apiKey;
private model;
private visionModel;
/** Provider name */
readonly provider: string;
/**
* Constructor
* @param apiKey Google 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;
/**
* Get the current vision model name
* @returns Vision model name
*/
getVisionModel(): 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>;
/**
* Convert AITuber OnAir messages to Gemini format
* @param messages Array of messages
* @returns Gemini formatted messages
*/
private convertMessagesToGeminiFormat;
/**
* Convert AITuber OnAir vision messages to Gemini format
* @param messages Array of vision messages
* @returns Gemini formatted vision messages
*/
private convertVisionMessagesToGeminiFormat;
/**
* Convert Blob to Base64 string
* @param blob Image blob
* @returns Promise with base64 encoded string
*/
private blobToBase64;
/**
* Map AITuber OnAir roles to Gemini roles
* @param role AITuber OnAir role
* @returns Gemini role
*/
private mapRoleToGemini;
}