MCPcopy Create free account
hub / github.com/MemTensor/MemOS / embedLocal

Function embedLocal

packages/memos-core/src/embedding/local.ts:26–36  ·  view source on GitHub ↗
(texts: string[], log: Logger)

Source from the content-addressed store, hash-verified

24}
25
26export async function embedLocal(texts: string[], log: Logger): Promise<number[][]> {
27 const ext = await getExtractor(log);
28 const results: number[][] = [];
29
30 for (const text of texts) {
31 const output = await ext(text, { pooling: "mean", normalize: true });
32 results.push(Array.from(output.data as Float32Array).slice(0, DEFAULTS.localEmbeddingDimensions));
33 }
34
35 return results;
36}

Callers 1

embedBatchMethod · 0.90

Calls 1

getExtractorFunction · 0.70

Tested by

no test coverage detected