Sycophant.EmbeddingResponse (sycophant v0.5.0)

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

Types

t()

@type t() :: %Sycophant.EmbeddingResponse{
  __type__: binary(),
  embeddings: any(),
  model: nil | binary(),
  raw: nil | any(),
  usage:
    nil
    | %Sycophant.Usage{
        __type__: binary(),
        cache_creation_input_tokens: nil | integer(),
        cache_read_cost: nil | float(),
        cache_read_input_tokens: nil | integer(),
        cache_write_cost: nil | float(),
        input_cost: nil | float(),
        input_tokens: nil | integer(),
        output_cost: nil | float(),
        output_tokens: nil | integer(),
        pricing:
          nil
          | %Sycophant.Pricing{
              __type__: binary(),
              components: [
                %Sycophant.Pricing.Component{
                  __type__: binary(),
                  id: nil | binary(),
                  kind: nil | binary(),
                  meter: nil | binary(),
                  notes: nil | binary(),
                  per: nil | integer(),
                  rate: nil | number(),
                  size_class: nil | binary(),
                  tool: nil | binary(),
                  unit: nil | binary()
                }
              ],
              currency: nil | binary()
            },
        reasoning_cost: nil | float(),
        reasoning_tokens: nil | integer(),
        total_cost: nil | float()
      }
}

Functions

t()