ExAthena.Embedding (ExAthena v0.18.0)

Copy Markdown View Source

A normalised embeddings response.

:embeddings is always a list of vectors, one per input — even when the caller embedded a single string. Indexing jobs feed hundreds of chunks through one call and zip the result back onto their inputs, so a shape that changes with the arity of the input would force every caller to branch.

:usage carries token accounting when the provider reports it (embedding endpoints only bill input tokens), and :raw keeps the provider's original payload for debugging.

Summary

Types

t()

@type t() :: %ExAthena.Embedding{
  embeddings: [vector()],
  model: String.t() | nil,
  provider: atom() | module() | nil,
  raw: term() | nil,
  usage: usage() | nil
}

usage()

@type usage() :: %{
  optional(:input_tokens) => non_neg_integer(),
  optional(:total_tokens) => non_neg_integer()
}

vector()

@type vector() :: [float()]