@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
36 lines (29 loc) • 998 B
text/typescript
import { EmbeddingModel } from "../types";
import { OpenAIEmbeddingModel } from "./openai";
export type EmbeddingModelType = "openai" | "huggingface" | "local";
export interface EmbeddingConfig {
type: EmbeddingModelType;
apiKey?: string;
modelName?: string;
baseUrl?: string;
}
export class EmbeddingFactory {
static create(config: EmbeddingConfig): EmbeddingModel {
switch (config.type) {
case "openai":
if (!config.apiKey) {
throw new Error("OpenAI API key is required");
}
return new OpenAIEmbeddingModel(config.apiKey, config.modelName);
// TODO: Add other embedding model implementations
// case 'huggingface':
// return new HuggingFaceEmbeddingModel(config);
// case 'local':
// return new LocalEmbeddingModel(config);
default:
throw new Error(`Unsupported embedding model type: ${config.type}`);
}
}
}
export * from "./openai";
export type { EmbeddingModel } from "../types";