import { IEmbeddings } from "../interfaces/IEmbedding"; import { OpenAIEmbeddingService } from "../services/embedding/openai"; import { EmbeddingAPIType, OptionsEmbeddingService } from "../types/embedding"; import { OllamaEmbeddingService } from "../services/embedding/ollama"; export class EmbeddingAPIFactory { static getAPI(type: EmbeddingAPIType, options?: OptionsEmbeddingService): IEmbeddings { switch (type) { case EmbeddingAPIType.OPENAI: return new OpenAIEmbeddingService(options) case EmbeddingAPIType.OLLAMA: return new OllamaEmbeddingService(options) default: throw new Error(`Invalid service type: ${type}`); } } }