TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Arize-ai/openinference/llms.txt
Use this file to discover all available pages before exploring further.
openinference.span.kind attribute is REQUIRED for all OpenInference spans and identifies the type of operation being traced. The span kind provides a hint to the tracing backend as to how the trace should be assembled and visualized.
The
openinference.span.kind attribute is distinct from OpenTelemetry’s span_kind field. The OpenTelemetry span_kind is usually set to SPAN_KIND_INTERNAL, while openinference.span.kind provides AI-specific classification.LLM
A span that represents a call to a Large Language Model (LLM). Example use cases:- Call to OpenAI for chat completions
- Call to Anthropic Claude
- Call to Llama for text generation
- Any language model API invocation
openinference.span.kind:"LLM"llm.system: The AI system/product (e.g., “openai”, “anthropic”)
llm.model_name: Model identifier (e.g., “gpt-4-0613”)llm.input_messages: Input messages arrayllm.output_messages: Output messages arrayllm.token_count.*: Token usage metricsllm.invocation_parameters: Model parameters (temperature, max_tokens, etc.)
Example
View LLM span specification
View LLM span specification
See the LLM Spans specification for complete details on LLM-specific attributes.
EMBEDDING
A span that represents a call to an LLM or embedding service for generating embeddings. Example use cases:- Call to OpenAI to get text-embedding-3-small embeddings
- Call to Cohere for embedding generation
- Generating embeddings for retrieval or similarity search
openinference.span.kind:"EMBEDDING"
embedding.model_name: Embedding model nameembedding.embeddings: Array of embedding objectsembedding.invocation_parameters: Model parametersllm.token_count.prompt: Number of tokens in input
Example
Unlike LLM spans, embedding spans use
embedding.model_name instead of llm.system and llm.provider.CHAIN
A span that represents a starting point or a link between different LLM application steps. Example use cases:- The beginning of a request to an LLM application
- Glue code that passes context from a retriever to an LLM call
- Orchestration logic connecting multiple operations
- Prompt formatting and post-processing
- Deterministic sequences of operations
Example
CHAIN spans often serve as root spans for traces, representing the overall operation before breaking down into sub-operations.
RETRIEVER
A span that represents a data retrieval step. Example use cases:- Call to a vector store (Pinecone, Weaviate, Chroma)
- Query to a traditional database
- Search engine query
- Document or knowledge base lookup
retrieval.documents: Array of retrieved documentsdocument.id: Document identifierdocument.content: Document text contentdocument.score: Relevance scoredocument.metadata: Additional document metadata
Example
RERANKER
A span that represents the reranking of a set of input documents. Example use cases:- Cross-encoder computing relevance scores
- Reordering retrieved documents by relevance to a query
- Selecting top K documents from a larger candidate set
reranker.input_documents: Documents before rerankingreranker.output_documents: Documents after rerankingreranker.query: The query used for rerankingreranker.model_name: Reranking model identifierreranker.top_k: Number of top documents to return
Example
Rerankers typically receive documents from a RETRIEVER span and pass refined results to an LLM span.
TOOL
A span that represents a call to an external tool such as a calculator, weather API, or any function execution. Example use cases:- Function called by an LLM (function calling)
- External API invocation (weather, database, search)
- Calculator or computation tool
- Custom business logic execution
tool.name: Name of the tooltool.description: Purpose of the tooltool.parameters: Parameter definitions (JSON schema)input.value: Tool input argumentsoutput.value: Tool execution result
Example
AGENT
A span that encompasses calls to LLMs and Tools. An agent describes a reasoning block that acts on tools using the guidance of an LLM. Example use cases:- ReAct agent loop
- Planning and execution agent
- Multi-step reasoning system
- Autonomous task completion
- Multiple LLM spans (reasoning steps)
- Multiple TOOL spans (actions taken)
- RETRIEVER spans (gathering information)
Example
AGENT spans typically have complex hierarchies with multiple reasoning iterations, each containing LLM and TOOL spans.
GUARDRAIL
A span that represents calls to a component to protect against jailbreak user input prompts by taking action to modify or reject an LLM’s response if it contains undesirable content. Example use cases:- Checking LLM output for inappropriate language
- Input validation and sanitization
- Output content filtering
- Safety and compliance checks
- Using external guardrail libraries (NeMo Guardrails, Guardrails AI)
Example
Guardrails can be placed before LLM calls (input validation) or after (output filtering).
EVALUATOR
A span that represents a call to a function or process performing an evaluation of the language model’s outputs. Example use cases:- LLM-as-judge evaluations
- Assessing response relevance
- Checking correctness of answers
- Measuring helpfulness or coherence
- Automated quality scoring
- Evaluation scores
- Judgment rationale
- Comparison results
Example
PROMPT
A span that represents the rendering of a prompt template. Example use cases:- Rendering a template with variables substituted
- Formatting prompts with dynamic content
- Template version management
- Prompt engineering workflows
llm.prompt_template.template: The template stringllm.prompt_template.variables: Key-value pairs for substitutionllm.prompt_template.version: Template version identifieroutput.value: Rendered prompt
Example
Span Kind Summary
| Span Kind | Primary Use Case | Common Parent | Common Children |
|---|---|---|---|
LLM | Language model API call | AGENT, CHAIN | TOOL |
EMBEDDING | Generate vector embeddings | RETRIEVER, CHAIN | None |
CHAIN | Orchestration/sequence | None (often root) | LLM, RETRIEVER, TOOL |
RETRIEVER | Vector/database search | CHAIN, AGENT | EMBEDDING |
RERANKER | Document reranking | CHAIN, AGENT | None |
TOOL | External function call | LLM, AGENT | None |
AGENT | Autonomous reasoning | CHAIN | LLM, TOOL, RETRIEVER |
GUARDRAIL | Content moderation | CHAIN, AGENT | None |
EVALUATOR | Response evaluation | CHAIN | LLM |
PROMPT | Template rendering | CHAIN, AGENT | None |
Next Steps
Attributes
Learn about span attributes and semantic conventions
Traces
Understand how spans form traces