Span Name
The span name MUST be"CreateEmbeddings" for embedding operations.
Required Attributes
All embedding spans MUST include:openinference.span.kind: Set to"EMBEDDING"
Common Attributes
Embedding spans typically include:| Attribute | Description |
|---|---|
embedding.model_name | Name of the embedding model (e.g., “text-embedding-3-small”) |
embedding.embeddings | Nested structure for embedding objects in batch operations |
embedding.invocation_parameters | JSON string of parameters sent to the model (excluding input) |
input.value | The raw input as a JSON string (text strings or token ID arrays) |
input.mime_type | Usually “application/json” |
output.value | The raw output (embedding vectors as JSON or base64-encoded) |
output.mime_type | Usually “application/json” |
llm.token_count.prompt | Number of tokens in the input |
llm.token_count.total | Total number of tokens used |
Text Attributes
Theembedding.embeddings.N.embedding.text attributes are populated ONLY when the input is already text (strings). These attributes are recorded during the request phase to ensure availability even on errors.
Vector Attributes
Theembedding.embeddings.N.embedding.vector attributes MUST contain float arrays, regardless of the API response format:
- Float response format: Store vectors directly as float arrays
- Base64 response format: MUST decode base64-encoded strings to float arrays before recording
- Base64 encoding is ~25% more compact in transmission but must be decoded for consistency
- Example: “AACAPwAAAEA=” → [1.5, 2.0]
Attributes Not Used in Embedding Spans
The following attributes that are used in LLM spans are not applicable to embedding spans:llm.system: Not used for embedding spansllm.provider: Not used for embedding spans
Rationale
Thellm.system attribute is defined as “the AI product as identified by the client or server instrumentation.” While this definition has been reserved for API providers in LLM spans (e.g., “openai”, “anthropic”), it is ambiguous when applied to embedding operations.
In terms of conceptualization, llm.system describes the shape of the API, while llm.provider describes the owner of the physical hardware that runs those APIs. For observability products like Arize and Phoenix, these conventions are primarily consumed in playground features, allowing re-invocation of LLM calls.
For embedding operations:
- The
embedding.model_nameattribute provides sufficient identification of the embedding model being used - The span kind
"EMBEDDING"clearly identifies the operation type - There is no concrete use case for playground re-invocation of embedding calls that would require
llm.system - Expanding the definition to include SDK/library names as systems does not facilitate any current observability use cases
embedding.model_name rather than llm.system or llm.provider.Privacy Considerations
WhenOPENINFERENCE_HIDE_EMBEDDINGS_VECTORS is set to true:
- The
embedding.embeddings.N.embedding.vectorattribute will contain"__REDACTED__" - The actual vector data will not be included in traces
OPENINFERENCE_HIDE_EMBEDDINGS_TEXT is set to true:
- The
embedding.embeddings.N.embedding.textattribute will contain"__REDACTED__" - The input text will not be included in traces
Input/Output Structure
The response structure matches the input structure:- Single input (text or token array) →
data[0]with one embedding - Array of N inputs →
data[0..N-1]with N embeddings
- Single text:
"hello world"→ single embedding - Text array:
["hello", "world"]→ array of embeddings - Single token array:
[15339, 1917]→ single embedding - Token array of arrays:
[[15339, 1917], [991, 1345]]→ array of embeddings