import type { BaseEmbeddings } from '@cherrystudio/embedjs-interfaces' import { TraceMethod } from '@mcp-trace/trace-core' import type { ApiClient } from '@types' import EmbeddingsFactory from './EmbeddingsFactory' export default class Embeddings { private sdk: BaseEmbeddings constructor({ embedApiClient, dimensions }: { embedApiClient: ApiClient; dimensions?: number }) { this.sdk = EmbeddingsFactory.create({ embedApiClient, dimensions }) } public async init(): Promise { return this.sdk.init() } @TraceMethod({ spanName: 'dimensions', tag: 'Embeddings' }) public async getDimensions(): Promise { return this.sdk.getDimensions() } @TraceMethod({ spanName: 'embedDocuments', tag: 'Embeddings' }) public async embedDocuments(texts: string[]): Promise { return this.sdk.embedDocuments(texts) } @TraceMethod({ spanName: 'embedQuery', tag: 'Embeddings' }) public async embedQuery(text: string): Promise { return this.sdk.embedQuery(text) } }