Skip to main content

parse_embeddings_response

Function parse_embeddings_response 

Source
pub fn parse_embeddings_response(value: &Value) -> Result<GeneratedEmbeddings>
Expand description

Parse an OpenAI-shaped embeddings response ({"data": [{"embedding": [...], "index": n}], "model": .., "usage": ..}) into a GeneratedEmbeddings, restoring input order via index.

embedding may be a numeric array (the default encoding_format: "float") or a base64 string of packed little-endian f32s (encoding_format: "base64"); both decode to the same vector.