MCPcopy Create free account
hub / github.com/OpenAnonymity/oa-chat / createEmbedding

Method createEmbedding

embeddings/embeddingService.js:80–103  ·  view source on GitHub ↗
(request, options = {})

Source from the content-addressed store, hash-verified

78 }
79
80 async createEmbedding(request, options = {}) {
81 const normalized = normalizeEmbeddingRequest(request);
82 const model = options.model || normalized.model || this.model;
83 if (!model) {
84 throw new Error('Embedding request is missing a model id.');
85 }
86
87 const { backendOptions, ...restOptions } = options;
88 if (backendOptions && this.backend?.configure) {
89 this.backend.configure(backendOptions);
90 }
91
92 const backendOptionsResolved = {
93 ...restOptions,
94 backendId: options.backendId || normalized.backend_id || normalized.backendId || this.backendId
95 };
96
97 const response = await this.backend.createEmbedding({
98 ...normalized,
99 model
100 }, backendOptionsResolved);
101
102 return normalizeEmbeddingResponse(response, { model });
103 }
104
105 async embedText(text, options = {}) {
106 const response = await this.createEmbedding({

Callers 7

embedTextMethod · 0.95
embedTextsMethod · 0.95
createEmbeddingFunction · 0.80
mainFunction · 0.80
runEmbeddingFunction · 0.80
createEmbeddingFunction · 0.80

Calls 2

Tested by

no test coverage detected