Expand description
§OpenInference Semantic Conventions for Rust
This crate provides attribute constants and types for the OpenInference semantic conventions.
OpenInference is a set of conventions for instrumenting LLM applications, compatible with OpenTelemetry and designed to work with observability platforms like Arize Phoenix.
§Usage
use openinference_semantic_conventions::{SpanKind, attributes};
use opentelemetry::KeyValue;
// Set the span kind
let kind = KeyValue::new(attributes::OPENINFERENCE_SPAN_KIND, SpanKind::Llm.as_str());
// Set LLM attributes
let model = KeyValue::new(attributes::llm::MODEL_NAME, "gpt-4");
let tokens = KeyValue::new(attributes::llm::token_count::TOTAL, 150i64);§OTel GenAI Compatibility
This crate also provides aliases for OpenTelemetry GenAI semantic conventions
via the gen_ai module, enabling compatibility with both OpenInference and OTel backends.
Modules§
- attributes
- OpenInference semantic convention attribute keys.
- gen_ai
- OpenTelemetry GenAI Semantic Conventions.
- prelude
- Re-export commonly used items
Enums§
- Span
Kind - OpenInference span kinds that identify the type of operation being traced.