Skip to main content

Overview

The @arizeai/openinference-semantic-conventions package provides TypeScript constants for OpenInference tracing attributes. These conventions ensure consistent attribute names across traces.

Installation

Package Exports

The package exports constants for trace attributes and resource attributes:

Span Kinds

OpenInference defines semantic span kinds for AI/LLM operations:

Usage Example

Input/Output Attributes

Standard attributes for span inputs and outputs:

Available MIME Types

LLM Attributes

Attributes specific to LLM operations:

Message Attributes

For chat completions with message arrays:

Retrieval Attributes

For document retrieval operations:

Embedding Attributes

For embedding operations:

Tool Attributes

For function/tool calling:

Context Attributes

For session and user tracking:

Resource Attributes

For identifying the project:

Semantic Conventions Object

The SemanticConventions export provides all attribute keys:

Best Practices

Use the core package helpers instead of setting attributes manually. The @arizeai/openinference-core package provides helper functions like getLLMAttributes() and getRetrieverAttributes() that handle attribute naming automatically.
Always use the exported constants rather than hardcoding attribute names. This ensures compatibility with future versions and prevents typos.

Next Steps

Core Package

Use attribute helpers from openinference-core

Instrumentations

Auto-instrument your LLM frameworks