Skip to main content

encode_embedding_blob

Function encode_embedding_blob 

Source
pub fn encode_embedding_blob(embedding: &[f32]) -> Vec<u8> 
Expand description

Encode a [f32] slice as a length-prefixed BLOB suitable for the memories.embedding column.

Layout: [0x01][LE f32 #0 (4 bytes)][LE f32 #1].... Empty input still emits the header so the round-trip preserves “I am an empty vector” versus “I am a legacy unheaded blob”; downstream code should treat empty embeddings as “no embedding” before reaching this codec.