Skip to main content
The openinference-semantic-conventions package defines standardized attributes for tracing AI/ML applications using OpenTelemetry.

Installation

SpanAttributes

The SpanAttributes class contains attribute keys for annotating spans with metadata about LLM calls, embeddings, retrievals, and more.

Import

Core Attributes

LLM Attributes

Attributes specific to Large Language Model operations:

Embedding Attributes

Retrieval Attributes

Tool Attributes

OpenInferenceSpanKindValues

The OpenInferenceSpanKindValues enum defines the types of operations in an AI application:

Usage Example

Message Attributes

For detailed message content:

Document Attributes

For retrieval results:

Additional Attribute Classes

  • MessageContentAttributes - Multi-modal message content (text, images)
  • ImageAttributes - Image URLs and data
  • AudioAttributes - Audio files and transcripts
  • EmbeddingAttributes - Individual embedding vectors
  • RerankerAttributes - Reranker inputs/outputs
  • ToolCallAttributes - Function call details
  • PromptAttributes - Completion API prompts
  • ChoiceAttributes - Completion API choices
See the full source code for complete attribute definitions.