@aituber-onair/core
Version:
Core library for AITuber OnAir providing voice synthesis and chat processing
62 lines • 2.01 kB
JavaScript
import { MODEL_CLAUDE_3_HAIKU, MODEL_CLAUDE_3_5_HAIKU, MODEL_CLAUDE_3_5_SONNET, MODEL_CLAUDE_3_7_SONNET, CLAUDE_VISION_SUPPORTED_MODELS, } from '../../../../constants';
import { ClaudeChatService } from './ClaudeChatService';
/**
* Claude API provider implementation
*/
export class ClaudeChatServiceProvider {
/**
* Create a chat service instance
* @param options Service options
* @returns ClaudeChatService instance
*/
createChatService(options) {
// Use the visionModel if provided, otherwise use the model that supports vision
const visionModel = options.visionModel ||
(this.supportsVisionForModel(options.model || this.getDefaultModel())
? options.model
: this.getDefaultModel());
return new ClaudeChatService(options.apiKey, options.model || this.getDefaultModel(), visionModel);
}
/**
* Get the provider name
* @returns Provider name ('claude')
*/
getProviderName() {
return 'claude';
}
/**
* Get the list of supported models
* @returns Array of supported model names
*/
getSupportedModels() {
return [
MODEL_CLAUDE_3_HAIKU,
MODEL_CLAUDE_3_5_HAIKU,
MODEL_CLAUDE_3_5_SONNET,
MODEL_CLAUDE_3_7_SONNET,
];
}
/**
* Get the default model
* @returns Default model name
*/
getDefaultModel() {
return MODEL_CLAUDE_3_HAIKU;
}
/**
* Check if this provider supports vision (image processing)
* @returns Vision support status (true)
*/
supportsVision() {
return true;
}
/**
* Check if a specific model supports vision capabilities
* @param model The model name to check
* @returns True if the model supports vision, false otherwise
*/
supportsVisionForModel(model) {
return CLAUDE_VISION_SUPPORTED_MODELS.includes(model);
}
}
//# sourceMappingURL=ClaudeChatServiceProvider.js.map