use opentelemetry::Key;
pub const OPENINFERENCE_SPAN_KIND: Key = Key::from_static_str("openinference.span.kind");
pub mod llm {
use opentelemetry::Key;
pub const MODEL_NAME: Key = Key::from_static_str("llm.model_name");
pub const SYSTEM: Key = Key::from_static_str("llm.system");
pub const PROVIDER: Key = Key::from_static_str("llm.provider");
pub const INVOCATION_PARAMETERS: Key = Key::from_static_str("llm.invocation_parameters");
pub const FUNCTION_CALL: Key = Key::from_static_str("llm.function_call");
pub mod input_messages {
use opentelemetry::Key;
pub fn role(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.input_messages.{index}.message.role").into_boxed_str(),
))
}
pub fn content(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.input_messages.{index}.message.content").into_boxed_str(),
))
}
pub fn content_type(index: usize, content_index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.input_messages.{index}.message.contents.{content_index}.message_content.type").into_boxed_str(),
))
}
pub fn content_text(index: usize, content_index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.input_messages.{index}.message.contents.{content_index}.message_content.text").into_boxed_str(),
))
}
}
pub mod output_messages {
use opentelemetry::Key;
pub fn role(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.output_messages.{index}.message.role").into_boxed_str(),
))
}
pub fn content(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.output_messages.{index}.message.content").into_boxed_str(),
))
}
pub mod tool_calls {
use opentelemetry::Key;
pub fn id(msg_index: usize, call_index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.output_messages.{msg_index}.message.tool_calls.{call_index}.tool_call.id").into_boxed_str(),
))
}
pub fn function_name(msg_index: usize, call_index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.output_messages.{msg_index}.message.tool_calls.{call_index}.tool_call.function.name").into_boxed_str(),
))
}
pub fn function_arguments(msg_index: usize, call_index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.output_messages.{msg_index}.message.tool_calls.{call_index}.tool_call.function.arguments").into_boxed_str(),
))
}
}
}
pub mod prompts {
use opentelemetry::Key;
pub fn text(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.prompts.{index}.prompt.text").into_boxed_str(),
))
}
}
pub mod choices {
use opentelemetry::Key;
pub fn text(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.choices.{index}.completion.text").into_boxed_str(),
))
}
}
pub mod tools {
use opentelemetry::Key;
pub fn json_schema(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("llm.tools.{index}.tool.json_schema").into_boxed_str(),
))
}
}
pub mod prompt_template {
use opentelemetry::Key;
pub const TEMPLATE: Key = Key::from_static_str("llm.prompt_template.template");
pub const VARIABLES: Key = Key::from_static_str("llm.prompt_template.variables");
pub const VERSION: Key = Key::from_static_str("llm.prompt_template.version");
}
pub mod token_count {
use opentelemetry::Key;
pub const PROMPT: Key = Key::from_static_str("llm.token_count.prompt");
pub const COMPLETION: Key = Key::from_static_str("llm.token_count.completion");
pub const TOTAL: Key = Key::from_static_str("llm.token_count.total");
pub mod prompt_details {
use opentelemetry::Key;
pub const CACHE_READ: Key =
Key::from_static_str("llm.token_count.prompt_details.cache_read");
pub const CACHE_WRITE: Key =
Key::from_static_str("llm.token_count.prompt_details.cache_write");
pub const AUDIO: Key = Key::from_static_str("llm.token_count.prompt_details.audio");
}
pub mod completion_details {
use opentelemetry::Key;
pub const REASONING: Key =
Key::from_static_str("llm.token_count.completion_details.reasoning");
pub const AUDIO: Key = Key::from_static_str("llm.token_count.completion_details.audio");
}
}
pub mod cost {
use opentelemetry::Key;
pub const PROMPT: Key = Key::from_static_str("llm.cost.prompt");
pub const COMPLETION: Key = Key::from_static_str("llm.cost.completion");
pub const TOTAL: Key = Key::from_static_str("llm.cost.total");
pub mod prompt_details {
use opentelemetry::Key;
pub const INPUT: Key = Key::from_static_str("llm.cost.prompt_details.input");
pub const CACHE_WRITE: Key =
Key::from_static_str("llm.cost.prompt_details.cache_write");
pub const CACHE_READ: Key = Key::from_static_str("llm.cost.prompt_details.cache_read");
pub const CACHE_INPUT: Key =
Key::from_static_str("llm.cost.prompt_details.cache_input");
pub const AUDIO: Key = Key::from_static_str("llm.cost.prompt_details.audio");
}
pub mod completion_details {
use opentelemetry::Key;
pub const OUTPUT: Key = Key::from_static_str("llm.cost.completion_details.output");
pub const REASONING: Key =
Key::from_static_str("llm.cost.completion_details.reasoning");
pub const AUDIO: Key = Key::from_static_str("llm.cost.completion_details.audio");
}
}
}
pub mod embedding {
use opentelemetry::Key;
pub const MODEL_NAME: Key = Key::from_static_str("embedding.model_name");
pub const TEXT: Key = Key::from_static_str("embedding.text");
pub const VECTOR: Key = Key::from_static_str("embedding.vector");
pub const INVOCATION_PARAMETERS: Key = Key::from_static_str("embedding.invocation_parameters");
pub mod embeddings {
use opentelemetry::Key;
pub fn vector(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("embedding.embeddings.{index}.embedding.vector").into_boxed_str(),
))
}
pub fn text(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("embedding.embeddings.{index}.embedding.text").into_boxed_str(),
))
}
}
}
pub mod tool {
use opentelemetry::Key;
pub const NAME: Key = Key::from_static_str("tool.name");
pub const DESCRIPTION: Key = Key::from_static_str("tool.description");
pub const JSON_SCHEMA: Key = Key::from_static_str("tool.json_schema");
pub const PARAMETERS: Key = Key::from_static_str("tool.parameters");
pub const ID: Key = Key::from_static_str("tool.id");
}
pub mod tool_call {
use opentelemetry::Key;
pub const ID: Key = Key::from_static_str("tool_call.id");
pub mod function {
use opentelemetry::Key;
pub const NAME: Key = Key::from_static_str("tool_call.function.name");
pub const ARGUMENTS: Key = Key::from_static_str("tool_call.function.arguments");
}
}
pub mod document {
use opentelemetry::Key;
pub const ID: Key = Key::from_static_str("document.id");
pub const CONTENT: Key = Key::from_static_str("document.content");
pub const SCORE: Key = Key::from_static_str("document.score");
pub const METADATA: Key = Key::from_static_str("document.metadata");
}
pub mod retrieval {
pub mod documents {
use opentelemetry::Key;
pub fn id(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("retrieval.documents.{index}.document.id").into_boxed_str(),
))
}
pub fn content(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("retrieval.documents.{index}.document.content").into_boxed_str(),
))
}
pub fn score(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("retrieval.documents.{index}.document.score").into_boxed_str(),
))
}
pub fn metadata(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("retrieval.documents.{index}.document.metadata").into_boxed_str(),
))
}
}
}
pub mod reranker {
use opentelemetry::Key;
pub const MODEL_NAME: Key = Key::from_static_str("reranker.model_name");
pub const QUERY: Key = Key::from_static_str("reranker.query");
pub const TOP_K: Key = Key::from_static_str("reranker.top_k");
pub mod input_documents {
use opentelemetry::Key;
pub fn id(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("reranker.input_documents.{index}.document.id").into_boxed_str(),
))
}
pub fn content(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("reranker.input_documents.{index}.document.content").into_boxed_str(),
))
}
pub fn score(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("reranker.input_documents.{index}.document.score").into_boxed_str(),
))
}
}
pub mod output_documents {
use opentelemetry::Key;
pub fn id(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("reranker.output_documents.{index}.document.id").into_boxed_str(),
))
}
pub fn content(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("reranker.output_documents.{index}.document.content").into_boxed_str(),
))
}
pub fn score(index: usize) -> Key {
Key::from_static_str(Box::leak(
format!("reranker.output_documents.{index}.document.score").into_boxed_str(),
))
}
}
}
pub mod input {
use opentelemetry::Key;
pub const VALUE: Key = Key::from_static_str("input.value");
pub const MIME_TYPE: Key = Key::from_static_str("input.mime_type");
}
pub mod output {
use opentelemetry::Key;
pub const VALUE: Key = Key::from_static_str("output.value");
pub const MIME_TYPE: Key = Key::from_static_str("output.mime_type");
}
pub mod user {
use opentelemetry::Key;
pub const ID: Key = Key::from_static_str("user.id");
}
pub mod session {
use opentelemetry::Key;
pub const ID: Key = Key::from_static_str("session.id");
}
pub mod exception {
use opentelemetry::Key;
pub const TYPE: Key = Key::from_static_str("exception.type");
pub const MESSAGE: Key = Key::from_static_str("exception.message");
pub const STACKTRACE: Key = Key::from_static_str("exception.stacktrace");
pub const ESCAPED: Key = Key::from_static_str("exception.escaped");
}
pub const METADATA: Key = Key::from_static_str("metadata");
pub mod tag {
use opentelemetry::Key;
pub const TAGS: Key = Key::from_static_str("tag.tags");
}
pub mod image {
use opentelemetry::Key;
pub const URL: Key = Key::from_static_str("image.url");
}
pub mod audio {
use opentelemetry::Key;
pub const URL: Key = Key::from_static_str("audio.url");
pub const MIME_TYPE: Key = Key::from_static_str("audio.mime_type");
pub const TRANSCRIPT: Key = Key::from_static_str("audio.transcript");
}
pub mod agent {
use opentelemetry::Key;
pub const NAME: Key = Key::from_static_str("agent.name");
}
pub mod graph {
pub mod node {
use opentelemetry::Key;
pub const ID: Key = Key::from_static_str("graph.node.id");
pub const NAME: Key = Key::from_static_str("graph.node.name");
pub const PARENT_ID: Key = Key::from_static_str("graph.node.parent_id");
}
}
pub mod prompt {
use opentelemetry::Key;
pub const VENDOR: Key = Key::from_static_str("prompt.vendor");
pub const ID: Key = Key::from_static_str("prompt.id");
pub const URL: Key = Key::from_static_str("prompt.url");
}
pub mod message {
use opentelemetry::Key;
pub const ROLE: Key = Key::from_static_str("message.role");
pub const CONTENT: Key = Key::from_static_str("message.content");
pub const FUNCTION_CALL_NAME: Key = Key::from_static_str("message.function_call_name");
pub const FUNCTION_CALL_ARGUMENTS_JSON: Key =
Key::from_static_str("message.function_call_arguments_json");
pub const TOOL_CALL_ID: Key = Key::from_static_str("message.tool_call_id");
}