Function embeddingToBlob

  • Serialize a number[] embedding to a compact Float32Array Buffer. ~50% smaller than JSON.stringify and avoids JSON.parse on read.

    Parameters

    • embedding: number[]

      The embedding vector.

    Returns Buffer

    Buffer containing raw float32 bytes.