Sycophant.EmbeddingResponse (sycophant v0.4.2)

Copy Markdown

The result of an embedding request.

Embeddings are keyed by type (e.g., :float, :int8), even when only one type is requested. Each value is a list of vectors corresponding to the input order.

Examples

{:ok, response} = Sycophant.embed(request)

# Access float embeddings
[first_vector | _rest] = response.embeddings.float
length(first_vector)
#=> 1024

# Multiple types when requested
response.embeddings
#=> %{float: [[0.1, ...], [0.2, ...]], int8: [[12, ...], [34, ...]]}

Summary

Functions

Reconstructs an EmbeddingResponse struct from a serialized map.

Types

t()

@type t() :: %Sycophant.EmbeddingResponse{
  embeddings: %{required(atom()) => [[number()]]},
  model: String.t() | nil,
  raw: map() | nil,
  usage: Sycophant.Usage.t() | nil
}

Functions

from_map(data)

@spec from_map(map()) :: t()

Reconstructs an EmbeddingResponse struct from a serialized map.