MCPcopy Index your code
hub / github.com/CaviraOSS/OpenMemory / vectorToBuffer

Function vectorToBuffer

backend/src/memory/embed.ts:640–644  ·  view source on GitHub ↗
(v: number[])

Source from the content-addressed store, hash-verified

638};
639
640export const vectorToBuffer = (v: number[]) => {
641 const b = Buffer.allocUnsafe(v.length * 4);
642 for (let i = 0; i < v.length; i++) b.writeFloatLE(v[i], i * 4);
643 return b;
644};
645export const bufferToVector = (b: Buffer) => {
646 const v: number[] = [];
647 for (let i = 0; i < b.length; i += 4) v.push(b.readFloatLE(i));

Callers 5

add_hsg_memoryFunction · 0.90
update_memoryFunction · 0.90
storeVectorMethod · 0.90
storeVectorMethod · 0.90
searchSimilarMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected