Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

feat: Adopt OpenTelemetry Semantic convention in GenAI spans (#1001)

Ishan Jainfe26729640bf
diff --git a/contributors/framework-instrumentation-guide.md b/contributors/framework-instrumentation-guide.md
index 6463b5bd..fb2509cd 100644
--- a/contributors/framework-instrumentation-guide.md
+++ b/contributors/framework-instrumentation-guide.md
@@ -281,7 +281,7 @@ span.set_attribute("gen_ai.system", "pydantic_ai")
from openlit.semcov import SemanticConvention
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT)
-span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_PYDANTIC_AI)
+span.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME, SemanticConvention.GEN_AI_SYSTEM_PYDANTIC_AI)
# Check existing constants first:
# - GEN_AI_OPERATION_TYPE_*
@@ -495,7 +495,7 @@ class OpenLITTracingProcessor(FrameworkProcessor):
```python
def _set_span_attributes(self, span, data):
# Standard framework attributes
- span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, "framework_name")
+ span.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME, "framework_name")
span.set_attribute(SemanticConvention.GEN_AI_OPERATION_NAME, operation_name)
# Model information (critical for business intelligence)
@@ -697,7 +697,7 @@ def set_span_attributes(span, operation_name: str, ctx: FrameworkInstrumentation
# Set core attributes using cached context
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, operation_name)
- span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_FRAMEWORK)
+ span.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME, SemanticConvention.GEN_AI_SYSTEM_FRAMEWORK)
span.set_attribute(SemanticConvention.GEN_AI_AGENT_NAME, ctx.agent_name)
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, ctx.model_name)
@@ -1322,7 +1322,7 @@ if __name__ == "__main__":
```python
# Always use semantic conventions
-span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, "framework_name")
+span.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME, "framework_name")
span.set_attribute(SemanticConvention.GEN_AI_OPERATION_NAME, operation_name)
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, model)
@@ -1343,8 +1343,8 @@ span.set_attribute(SemanticConvention.GEN_AI_USAGE_OUTPUT_TOKENS, output_tokens)
span.set_attribute(SemanticConvention.GEN_AI_CLIENT_OPERATION_DURATION, duration)
# Content capture with MIME types
-span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, content)
-span.set_attribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, response)
+span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, content)
+span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, response)
```
## Quality Checklist
diff --git a/sdk/python/src/openlit/__helpers.py b/sdk/python/src/openlit/__helpers.py
index 901a584e..5b428455 100644
--- a/sdk/python/src/openlit/__helpers.py
+++ b/sdk/python/src/openlit/__helpers.py
@@ -218,7 +218,7 @@ def create_metrics_attributes(
SERVICE_NAME: service_name,
DEPLOYMENT_ENVIRONMENT: deployment_environment,
SemanticConvention.GEN_AI_OPERATION: operation,
- SemanticConvention.GEN_AI_SYSTEM: system,
+ SemanticConvention.GEN_AI_PROVIDER_NAME: system,
SemanticConvention.GEN_AI_REQUEST_MODEL: request_model,
SemanticConvention.SERVER_ADDRESS: server_address,
SemanticConvention.SERVER_PORT: server_port,
@@ -423,7 +423,7 @@ def format_and_concatenate(messages):
def common_span_attributes(
scope,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -441,7 +441,9 @@ def common_span_attributes(
scope._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
scope._span.set_attribute(SemanticConvention.GEN_AI_OPERATION, gen_ai_operation)
- scope._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, gen_ai_system)
+ scope._span.set_attribute(
+ SemanticConvention.GEN_AI_PROVIDER_NAME, GEN_AI_PROVIDER_NAME
+ )
scope._span.set_attribute(SemanticConvention.SERVER_ADDRESS, server_address)
scope._span.set_attribute(SemanticConvention.SERVER_PORT, server_port)
if request_model:
@@ -463,7 +465,7 @@ def common_span_attributes(
def record_completion_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -484,7 +486,7 @@ def record_completion_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -507,7 +509,7 @@ def record_completion_metrics(
def record_embedding_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -525,7 +527,7 @@ def record_embedding_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -543,7 +545,7 @@ def record_embedding_metrics(
def record_audio_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -560,7 +562,7 @@ def record_audio_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -576,7 +578,7 @@ def record_audio_metrics(
def record_image_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -593,7 +595,7 @@ def record_image_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -649,7 +651,7 @@ def common_framework_span_attributes(
scope._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
scope._span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION, version)
- scope._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, framework_system)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME, framework_system)
scope._span.set_attribute(SemanticConvention.GEN_AI_OPERATION, endpoint)
scope._span.set_attribute(
SemanticConvention.GEN_AI_REQUEST_MODEL,
@@ -813,7 +815,7 @@ def record_mcp_metrics(
def record_framework_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
environment,
@@ -827,7 +829,7 @@ def record_framework_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model="unknown",
diff --git a/sdk/python/src/openlit/__init__.py b/sdk/python/src/openlit/__init__.py
index 6b814aac..459186ad 100644
--- a/sdk/python/src/openlit/__init__.py
+++ b/sdk/python/src/openlit/__init__.py
@@ -582,7 +582,7 @@ def trace(wrapped):
try:
response = wrapped(*args, **kwargs)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, response or ""
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, response or ""
)
span.set_status(Status(StatusCode.OK))
except Exception as e:
@@ -639,7 +639,7 @@ class TracedSpan:
result: The result to be set as an attribute on the span.
"""
- self._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, result)
+ self._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, result)
def set_metadata(self, metadata: Dict):
"""
diff --git a/sdk/python/src/openlit/instrumentation/ag2/utils.py b/sdk/python/src/openlit/instrumentation/ag2/utils.py
index e1adefcb..c97bf0db 100644
--- a/sdk/python/src/openlit/instrumentation/ag2/utils.py
+++ b/sdk/python/src/openlit/instrumentation/ag2/utils.py
@@ -127,14 +127,14 @@ def common_agent_logic(
if capture_message_content and hasattr(scope, "_chat_history"):
chat_content = format_content(scope._chat_history)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, chat_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, chat_content
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: chat_content,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: chat_content,
},
)
@@ -402,7 +402,7 @@ def process_agent_receive(
# Content capture for received message
if capture_message_content:
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, str(message))
+ span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, str(message))
common_agent_logic(
scope,
@@ -465,7 +465,7 @@ def process_agent_send(
# Content capture for sent message
if capture_message_content:
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, str(message))
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, str(message))
common_agent_logic(
scope,
@@ -536,7 +536,7 @@ def process_groupchat_operation(
# Content capture for GroupChat
if capture_message_content and messages:
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, str(messages))
+ span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, str(messages))
# Use framework operation type for GroupChat
common_agent_logic(
diff --git a/sdk/python/src/openlit/instrumentation/agno/utils.py b/sdk/python/src/openlit/instrumentation/agno/utils.py
index adbd4c19..ddc3e3a1 100644
--- a/sdk/python/src/openlit/instrumentation/agno/utils.py
+++ b/sdk/python/src/openlit/instrumentation/agno/utils.py
@@ -147,18 +147,18 @@ def process_agent_request(
if args and args[0]:
if capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, str(args[0])[:1000]
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, str(args[0])[:1000]
)
# agno 2.x versions agent.run use input instead of args[0]
if kwargs and kwargs.get("input", None) and capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, str(kwargs["input"])[:1000]
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, str(kwargs["input"])[:1000]
)
# agno 2.x versions team.run use input_message instead of args[0]
if kwargs and kwargs.get("input_message", None) and capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES,
str(kwargs["input_message"])[:1000],
)
@@ -207,14 +207,10 @@ def process_agent_request(
if capture_message_content:
if hasattr(response, "content") and response.content:
content = str(response.content)[:2000]
- span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, content
- )
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, content)
elif hasattr(response, "message") and response.message:
content = str(response.message)[:2000]
- span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, content
- )
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, content)
# Capture additional response metadata
if hasattr(response, "metrics"):
diff --git a/sdk/python/src/openlit/instrumentation/ai21/utils.py b/sdk/python/src/openlit/instrumentation/ai21/utils.py
index 8f78323f..da1ee9d8 100644
--- a/sdk/python/src/openlit/instrumentation/ai21/utils.py
+++ b/sdk/python/src/openlit/instrumentation/ai21/utils.py
@@ -202,22 +202,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
@@ -426,22 +426,22 @@ def common_chat_rag_logic(
# Content attributes
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/anthropic/utils.py b/sdk/python/src/openlit/instrumentation/anthropic/utils.py
index 367533be..1e7a0869 100644
--- a/sdk/python/src/openlit/instrumentation/anthropic/utils.py
+++ b/sdk/python/src/openlit/instrumentation/anthropic/utils.py
@@ -553,10 +553,10 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, formatted_messages
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, formatted_messages
)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit inference event
diff --git a/sdk/python/src/openlit/instrumentation/assemblyai/utils.py b/sdk/python/src/openlit/instrumentation/assemblyai/utils.py
index dd5cae0a..16e9f54c 100644
--- a/sdk/python/src/openlit/instrumentation/assemblyai/utils.py
+++ b/sdk/python/src/openlit/instrumentation/assemblyai/utils.py
@@ -28,7 +28,7 @@ def format_audio_url(audio_url):
def common_span_attributes(
scope,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -46,7 +46,9 @@ def common_span_attributes(
scope._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
scope._span.set_attribute(SemanticConvention.GEN_AI_OPERATION, gen_ai_operation)
- scope._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, gen_ai_system)
+ scope._span.set_attribute(
+ SemanticConvention.GEN_AI_PROVIDER_NAME, GEN_AI_PROVIDER_NAME
+ )
scope._span.set_attribute(SemanticConvention.SERVER_ADDRESS, server_address)
scope._span.set_attribute(SemanticConvention.SERVER_PORT, server_port)
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, request_model)
@@ -64,7 +66,7 @@ def common_span_attributes(
def record_audio_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -81,7 +83,7 @@ def record_audio_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -149,22 +151,22 @@ def common_audio_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._response.text
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._response.text
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._response.text,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._response.text,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/azure_ai_inference/utils.py b/sdk/python/src/openlit/instrumentation/azure_ai_inference/utils.py
index c3f20cd7..d9d2ce8c 100644
--- a/sdk/python/src/openlit/instrumentation/azure_ai_inference/utils.py
+++ b/sdk/python/src/openlit/instrumentation/azure_ai_inference/utils.py
@@ -486,9 +486,9 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Add reasoning content if available
@@ -736,7 +736,7 @@ def common_embedding_logic(
# Span Attributes for Content
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES,
str(scope._kwargs.get("input", "")),
)
diff --git a/sdk/python/src/openlit/instrumentation/bedrock/utils.py b/sdk/python/src/openlit/instrumentation/bedrock/utils.py
index f910f963..3e29afb3 100644
--- a/sdk/python/src/openlit/instrumentation/bedrock/utils.py
+++ b/sdk/python/src/openlit/instrumentation/bedrock/utils.py
@@ -419,10 +419,10 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, formatted_messages
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, formatted_messages
)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit OTel log event
diff --git a/sdk/python/src/openlit/instrumentation/browser_use/async_browser_use.py b/sdk/python/src/openlit/instrumentation/browser_use/async_browser_use.py
index fa174534..04c747af 100644
--- a/sdk/python/src/openlit/instrumentation/browser_use/async_browser_use.py
+++ b/sdk/python/src/openlit/instrumentation/browser_use/async_browser_use.py
@@ -451,7 +451,7 @@ async def _create_detailed_step_span(
) as step_span:
# Basic step information
step_span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_BROWSER_USE,
)
step_span.set_attribute(SemanticConvention.GEN_AI_OPERATION, "step")
@@ -627,7 +627,7 @@ async def _create_individual_action_spans(
) as action_span:
# Basic action information
action_span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_BROWSER_USE,
)
action_span.set_attribute(
diff --git a/sdk/python/src/openlit/instrumentation/browser_use/utils.py b/sdk/python/src/openlit/instrumentation/browser_use/utils.py
index 80fa55c5..b3d6fd89 100644
--- a/sdk/python/src/openlit/instrumentation/browser_use/utils.py
+++ b/sdk/python/src/openlit/instrumentation/browser_use/utils.py
@@ -244,7 +244,8 @@ def set_span_attributes(
# Core framework attributes
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_BROWSER_USE
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
+ SemanticConvention.GEN_AI_SYSTEM_BROWSER_USE,
)
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, operation_name)
@@ -368,13 +369,13 @@ def process_response(
if capture_message_content:
if isinstance(response, str):
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, response[:1000]
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, response[:1000]
)
elif hasattr(response, "__dict__"):
try:
content = json.dumps(response.__dict__, default=str)[:1000]
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, content
)
except (TypeError, ValueError):
pass
diff --git a/sdk/python/src/openlit/instrumentation/cohere/utils.py b/sdk/python/src/openlit/instrumentation/cohere/utils.py
index c4554025..d39925bd 100644
--- a/sdk/python/src/openlit/instrumentation/cohere/utils.py
+++ b/sdk/python/src/openlit/instrumentation/cohere/utils.py
@@ -264,22 +264,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
@@ -462,13 +462,13 @@ def common_embedding_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, str(inputs))
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, str(inputs))
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: str(inputs),
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: str(inputs),
},
)
diff --git a/sdk/python/src/openlit/instrumentation/controlflow/controlflow.py b/sdk/python/src/openlit/instrumentation/controlflow/controlflow.py
index 7b59d8e4..d0097342 100644
--- a/sdk/python/src/openlit/instrumentation/controlflow/controlflow.py
+++ b/sdk/python/src/openlit/instrumentation/controlflow/controlflow.py
@@ -78,7 +78,7 @@ def wrap_controlflow(
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT, gen_ai_endpoint)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_CONTROLFLOW,
)
span.set_attribute(DEPLOYMENT_ENVIRONMENT, environment)
diff --git a/sdk/python/src/openlit/instrumentation/crawl4ai/utils.py b/sdk/python/src/openlit/instrumentation/crawl4ai/utils.py
index e7f34613..b4eff3f6 100644
--- a/sdk/python/src/openlit/instrumentation/crawl4ai/utils.py
+++ b/sdk/python/src/openlit/instrumentation/crawl4ai/utils.py
@@ -203,7 +203,8 @@ def set_crawl_attributes(
# Core framework attributes
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_CRAWL4AI
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
+ SemanticConvention.GEN_AI_SYSTEM_CRAWL4AI,
)
# Map operation to semantic convention
@@ -507,12 +508,12 @@ def capture_message_content_if_enabled(
try:
# Capture input URL(s) as prompt
if ctx.url and ctx.url != "unknown":
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, ctx.url)
+ span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, ctx.url)
elif ctx.urls:
urls_str = ", ".join(ctx.urls[:5]) # Limit to first 5 URLs
if len(ctx.urls) > 5:
urls_str += f" and {len(ctx.urls) - 5} more"
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, urls_str)
+ span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, urls_str)
# Capture output content based on response type
if response is None:
@@ -522,19 +523,19 @@ def capture_message_content_if_enabled(
# For batch responses, capture summary
completion_summary = f"Crawled {len(response)} URLs"
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, completion_summary
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, completion_summary
)
else:
# For single responses, capture markdown content (limited)
if hasattr(response, "markdown") and response.markdown:
formatted_content = format_content(response.markdown, max_length=2000)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, formatted_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, formatted_content
)
elif hasattr(response, "html") and response.html:
formatted_content = format_content(response.html, max_length=1000)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, formatted_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, formatted_content
)
except Exception as e:
@@ -799,14 +800,14 @@ def capture_extraction_content(
if isinstance(extraction_input, str):
input_content = format_content(extraction_input, max_length=1000)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, input_content
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, input_content
)
elif hasattr(extraction_input, "__iter__"):
# Handle list/tuple of inputs
combined_input = " ".join(str(item)[:200] for item in extraction_input)
input_content = format_content(combined_input, max_length=1000)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, input_content
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, input_content
)
# Capture extraction output as completion
@@ -815,13 +816,13 @@ def capture_extraction_content(
# Format structured output
output_summary = f"Extracted {len(extraction_output) if hasattr(extraction_output, '__len__') else 1} items"
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, output_summary
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, output_summary
)
else:
# Handle string output
output_content = format_content(str(extraction_output), max_length=1000)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, output_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, output_content
)
except Exception as e:
diff --git a/sdk/python/src/openlit/instrumentation/crewai/utils.py b/sdk/python/src/openlit/instrumentation/crewai/utils.py
index 27dc24f2..b4baa1ce 100644
--- a/sdk/python/src/openlit/instrumentation/crewai/utils.py
+++ b/sdk/python/src/openlit/instrumentation/crewai/utils.py
@@ -519,7 +519,7 @@ def _capture_content(span, instance, response, endpoint):
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: str(response)[
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: str(response)[
:1000
], # Limit size
},
@@ -532,7 +532,7 @@ def _capture_content(span, instance, response, endpoint):
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: task_description[
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: task_description[
:1000
],
},
diff --git a/sdk/python/src/openlit/instrumentation/dynamiq/dynamiq.py b/sdk/python/src/openlit/instrumentation/dynamiq/dynamiq.py
index 9c02dfd1..65f47855 100644
--- a/sdk/python/src/openlit/instrumentation/dynamiq/dynamiq.py
+++ b/sdk/python/src/openlit/instrumentation/dynamiq/dynamiq.py
@@ -73,7 +73,7 @@ def dynamiq_wrap(
# Set base span attribues
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_DYNAMIQ,
)
span.set_attribute(
diff --git a/sdk/python/src/openlit/instrumentation/elevenlabs/utils.py b/sdk/python/src/openlit/instrumentation/elevenlabs/utils.py
index 65274840..721de560 100644
--- a/sdk/python/src/openlit/instrumentation/elevenlabs/utils.py
+++ b/sdk/python/src/openlit/instrumentation/elevenlabs/utils.py
@@ -28,7 +28,7 @@ def format_content(text):
def common_span_attributes(
scope,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -46,7 +46,9 @@ def common_span_attributes(
scope._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
scope._span.set_attribute(SemanticConvention.GEN_AI_OPERATION, gen_ai_operation)
- scope._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, gen_ai_system)
+ scope._span.set_attribute(
+ SemanticConvention.GEN_AI_PROVIDER_NAME, GEN_AI_PROVIDER_NAME
+ )
scope._span.set_attribute(SemanticConvention.SERVER_ADDRESS, server_address)
scope._span.set_attribute(SemanticConvention.SERVER_PORT, server_port)
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, request_model)
@@ -64,7 +66,7 @@ def common_span_attributes(
def record_audio_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -81,7 +83,7 @@ def record_audio_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -154,13 +156,13 @@ def common_audio_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, text)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, text)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: text,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: text,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/firecrawl/utils.py b/sdk/python/src/openlit/instrumentation/firecrawl/utils.py
index 8b9186e5..91ddeaf8 100644
--- a/sdk/python/src/openlit/instrumentation/firecrawl/utils.py
+++ b/sdk/python/src/openlit/instrumentation/firecrawl/utils.py
@@ -265,7 +265,7 @@ def process_response(
f"Processed {len(response)} URLs, {success_count} successful"
)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, completion_summary
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, completion_summary
)
span.set_status(Status(StatusCode.OK))
elif hasattr(response, "__dict__") or hasattr(response, "success"):
@@ -440,26 +440,26 @@ def _capture_content_summary(
"""Capture content summary (not full content) for tracing."""
try:
# Input: URL as prompt
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, ctx.url)
+ span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, ctx.url)
# Output: Content summary (NOT full content)
if "markdown" in response and response["markdown"]:
# Just show first 500 chars of markdown as sample
formatted_content = format_content(response["markdown"], max_length=500)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, formatted_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, formatted_content
)
elif "html" in response and response["html"]:
# Show first 300 chars of HTML as sample
formatted_content = format_content(response["html"], max_length=300)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, formatted_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, formatted_content
)
elif "text" in response and response["text"]:
# Show first 500 chars of text as sample
formatted_content = format_content(response["text"], max_length=500)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, formatted_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, formatted_content
)
else:
# Fallback: show what was scraped
@@ -467,11 +467,11 @@ def _capture_content_summary(
title = metadata.get("title", "")
if title:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, f"Scraped: {title}"
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, f"Scraped: {title}"
)
else:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
"Content scraped successfully",
)
diff --git a/sdk/python/src/openlit/instrumentation/google_ai_studio/utils.py b/sdk/python/src/openlit/instrumentation/google_ai_studio/utils.py
index d4cd0c79..ccdf9665 100644
--- a/sdk/python/src/openlit/instrumentation/google_ai_studio/utils.py
+++ b/sdk/python/src/openlit/instrumentation/google_ai_studio/utils.py
@@ -484,7 +484,7 @@ def common_chat_logic(
SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_GEMINI
+ SemanticConvention.GEN_AI_PROVIDER_NAME, SemanticConvention.GEN_AI_SYSTEM_GEMINI
)
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, request_model)
scope._span.set_attribute(SemanticConvention.SERVER_PORT, scope._server_port)
@@ -555,9 +555,9 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit inference event
diff --git a/sdk/python/src/openlit/instrumentation/gpt4all/utils.py b/sdk/python/src/openlit/instrumentation/gpt4all/utils.py
index 0c413df6..b7f419cf 100644
--- a/sdk/python/src/openlit/instrumentation/gpt4all/utils.py
+++ b/sdk/python/src/openlit/instrumentation/gpt4all/utils.py
@@ -49,7 +49,7 @@ def process_chunk(scope, chunk):
def common_span_attributes(
scope,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -67,7 +67,9 @@ def common_span_attributes(
scope._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
scope._span.set_attribute(SemanticConvention.GEN_AI_OPERATION, gen_ai_operation)
- scope._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, gen_ai_system)
+ scope._span.set_attribute(
+ SemanticConvention.GEN_AI_PROVIDER_NAME, GEN_AI_PROVIDER_NAME
+ )
scope._span.set_attribute(SemanticConvention.SERVER_ADDRESS, server_address)
scope._span.set_attribute(SemanticConvention.SERVER_PORT, server_port)
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, request_model)
@@ -83,7 +85,7 @@ def common_span_attributes(
def record_completion_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -104,7 +106,7 @@ def record_completion_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -129,7 +131,7 @@ def record_completion_metrics(
def record_embedding_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -147,7 +149,7 @@ def record_embedding_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -262,22 +264,22 @@ def common_t2s_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed one the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
@@ -357,7 +359,7 @@ def common_embedding_logic(
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: str(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: str(
scope._kwargs.get("input", "")
),
},
diff --git a/sdk/python/src/openlit/instrumentation/groq/utils.py b/sdk/python/src/openlit/instrumentation/groq/utils.py
index f07d06f1..48cbc82c 100644
--- a/sdk/python/src/openlit/instrumentation/groq/utils.py
+++ b/sdk/python/src/openlit/instrumentation/groq/utils.py
@@ -199,22 +199,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed one the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/haystack/utils.py b/sdk/python/src/openlit/instrumentation/haystack/utils.py
index 0b2e7f1d..04125fd8 100644
--- a/sdk/python/src/openlit/instrumentation/haystack/utils.py
+++ b/sdk/python/src/openlit/instrumentation/haystack/utils.py
@@ -395,7 +395,7 @@ def process_haystack_response(
replies = value["replies"]
if replies and capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
str(replies[0])[:500],
)
break
diff --git a/sdk/python/src/openlit/instrumentation/julep/async_julep.py b/sdk/python/src/openlit/instrumentation/julep/async_julep.py
index 8d98738e..ebd60d25 100644
--- a/sdk/python/src/openlit/instrumentation/julep/async_julep.py
+++ b/sdk/python/src/openlit/instrumentation/julep/async_julep.py
@@ -78,7 +78,7 @@ def async_wrap_julep(
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT, gen_ai_endpoint)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_JULEP,
)
span.set_attribute(DEPLOYMENT_ENVIRONMENT, environment)
@@ -116,7 +116,7 @@ def async_wrap_julep(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: str(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: str(
kwargs.get("input", "")
),
},
diff --git a/sdk/python/src/openlit/instrumentation/julep/julep.py b/sdk/python/src/openlit/instrumentation/julep/julep.py
index a1bfc8dd..f5a9ead2 100644
--- a/sdk/python/src/openlit/instrumentation/julep/julep.py
+++ b/sdk/python/src/openlit/instrumentation/julep/julep.py
@@ -78,7 +78,7 @@ def wrap_julep(
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(SemanticConvention.GEN_AI_ENDPOINT, gen_ai_endpoint)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_JULEP,
)
span.set_attribute(DEPLOYMENT_ENVIRONMENT, environment)
@@ -116,7 +116,7 @@ def wrap_julep(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: str(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: str(
kwargs.get("input", "")
),
},
diff --git a/sdk/python/src/openlit/instrumentation/langchain/__init__.py b/sdk/python/src/openlit/instrumentation/langchain/__init__.py
index 9ce9f9ab..7a9636b9 100644
--- a/sdk/python/src/openlit/instrumentation/langchain/__init__.py
+++ b/sdk/python/src/openlit/instrumentation/langchain/__init__.py
@@ -849,7 +849,7 @@ def _create_callback_handler_class(
span = self._create_span(run_id, parent_run_id, span_name)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
)
self._set_common_attributes(span, operation_type)
@@ -903,7 +903,7 @@ def _create_callback_handler_class(
record_framework_metrics(
metrics=self._metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
server_address="localhost",
server_port=8080,
environment=self._environment,
@@ -965,7 +965,7 @@ def _create_callback_handler_class(
run_id, parent_run_id, span_name, SpanKind.CLIENT
)
- span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, provider)
+ span.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME, provider)
self._set_common_attributes(
span, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT
)
@@ -979,7 +979,7 @@ def _create_callback_handler_class(
if self._capture_message_content and prompts:
prompt_str = "\n".join(prompts)[:5000]
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt_str
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt_str
)
self.spans[run_id].input_tokens = general_tokens(prompt_str)
@@ -1017,7 +1017,7 @@ def _create_callback_handler_class(
run_id, parent_run_id, span_name, SpanKind.CLIENT
)
- span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, provider)
+ span.set_attribute(SemanticConvention.GEN_AI_PROVIDER_NAME, provider)
self._set_common_attributes(
span, SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT
)
@@ -1045,7 +1045,7 @@ def _create_callback_handler_class(
# Set prompt attribute if capturing content
if self._capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt_str
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt_str
)
# Store structured messages for event emission
@@ -1222,7 +1222,7 @@ def _create_callback_handler_class(
# Set completion content attribute
if completion_content and self._capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
completion_content[:5000],
)
@@ -1313,7 +1313,7 @@ def _create_callback_handler_class(
record_completion_metrics(
metrics=self._metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
server_address="localhost",
server_port=8080,
request_model=model_name,
@@ -1379,7 +1379,7 @@ def _create_callback_handler_class(
span = self._create_span(run_id, parent_run_id, span_name)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
)
self._set_common_attributes(
@@ -1427,7 +1427,7 @@ def _create_callback_handler_class(
record_framework_metrics(
metrics=self._metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_TOOLS,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
server_address="localhost",
server_port=8080,
environment=self._environment,
@@ -1486,7 +1486,7 @@ def _create_callback_handler_class(
span = self._create_span(run_id, parent_run_id, span_name)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
)
self._set_common_attributes(
@@ -1542,7 +1542,7 @@ def _create_callback_handler_class(
record_framework_metrics(
metrics=self._metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_RETRIEVE,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_LANGCHAIN,
server_address="localhost",
server_port=8080,
environment=self._environment,
diff --git a/sdk/python/src/openlit/instrumentation/langgraph/async_langgraph.py b/sdk/python/src/openlit/instrumentation/langgraph/async_langgraph.py
index 0b0656dc..9e2bf895 100644
--- a/sdk/python/src/openlit/instrumentation/langgraph/async_langgraph.py
+++ b/sdk/python/src/openlit/instrumentation/langgraph/async_langgraph.py
@@ -181,7 +181,8 @@ async def _create_async_stream_wrapper(
span.set_attribute("telemetry.sdk.name", "openlit")
span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION, version)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_LANGGRAPH
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
+ SemanticConvention.GEN_AI_SYSTEM_LANGGRAPH,
)
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, operation_type)
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, "unknown")
@@ -337,7 +338,7 @@ def _finalize_async_stream_span(
execution_state["final_response"][:500],
)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
execution_state["final_response"][:1000],
)
@@ -396,7 +397,7 @@ def async_checkpoint_wrap(
# Set basic attributes
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_LANGGRAPH,
)
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, operation_type)
diff --git a/sdk/python/src/openlit/instrumentation/langgraph/langgraph.py b/sdk/python/src/openlit/instrumentation/langgraph/langgraph.py
index a1c17714..6a236488 100644
--- a/sdk/python/src/openlit/instrumentation/langgraph/langgraph.py
+++ b/sdk/python/src/openlit/instrumentation/langgraph/langgraph.py
@@ -154,7 +154,8 @@ def _handle_stream(
span.set_attribute("telemetry.sdk.name", "openlit")
span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION, version)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_LANGGRAPH
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
+ SemanticConvention.GEN_AI_SYSTEM_LANGGRAPH,
)
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, endpoint)
span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, "unknown")
@@ -266,7 +267,7 @@ def _finalize_stream_span(span, execution_state, capture_message_content, start_
execution_state["final_response"][:500],
)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
execution_state["final_response"][:1000],
)
@@ -415,7 +416,7 @@ def wrap_add_node(
) as span:
start_time = time.time()
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_LANGGRAPH,
)
span.set_attribute(
@@ -471,7 +472,7 @@ def wrap_add_node(
) as span:
start_time = time.time()
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_LANGGRAPH,
)
span.set_attribute(
diff --git a/sdk/python/src/openlit/instrumentation/langgraph/utils.py b/sdk/python/src/openlit/instrumentation/langgraph/utils.py
index 750f06c2..68d2e39a 100644
--- a/sdk/python/src/openlit/instrumentation/langgraph/utils.py
+++ b/sdk/python/src/openlit/instrumentation/langgraph/utils.py
@@ -271,7 +271,7 @@ def extract_llm_info_from_result(span, state, result):
content = get_message_content(last_msg)
if content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, content[:1000]
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, content[:1000]
)
# Extract usage_metadata (alternative location)
@@ -579,7 +579,7 @@ def _process_invoke_response(span, response, capture_message_content):
SemanticConvention.LANGGRAPH_FINAL_RESPONSE, content[:500]
)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, content[:1000]
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, content[:1000]
)
# Try to extract LLM info
diff --git a/sdk/python/src/openlit/instrumentation/letta/utils.py b/sdk/python/src/openlit/instrumentation/letta/utils.py
index 0b190e0a..372702f9 100644
--- a/sdk/python/src/openlit/instrumentation/letta/utils.py
+++ b/sdk/python/src/openlit/instrumentation/letta/utils.py
@@ -375,13 +375,13 @@ def _set_content_attributes(span, kwargs, response):
# Input content
if "messages" in kwargs:
messages_str = json.dumps(str(kwargs["messages"]))
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, messages_str)
+ span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, messages_str)
# Output content
if response and hasattr(response, "messages"):
completion_str = str(response.messages)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, completion_str
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, completion_str
)
except Exception:
pass
@@ -627,11 +627,11 @@ class TracedLettaStream:
if self._capture_content and self._response_messages:
completion_content = str(self._response_messages)
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, completion_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, completion_content
)
elif self._capture_content and self._response_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, self._response_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, self._response_content
)
except Exception:
@@ -662,14 +662,14 @@ class TracedLettaStream:
# Set content if enabled
if self._capture_content and self._response_content:
self._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
self._response_content,
)
elif self._capture_content and self._response_messages:
# Fallback: Use response messages if no direct content
completion_content = str(self._response_messages)
self._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, completion_content
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, completion_content
)
# Set response messages if available
diff --git a/sdk/python/src/openlit/instrumentation/litellm/utils.py b/sdk/python/src/openlit/instrumentation/litellm/utils.py
index 0024c231..95223801 100644
--- a/sdk/python/src/openlit/instrumentation/litellm/utils.py
+++ b/sdk/python/src/openlit/instrumentation/litellm/utils.py
@@ -472,9 +472,9 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit OTel log event
@@ -712,7 +712,7 @@ def process_embedding_response(
# Span Attributes for Content
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES,
str(scope._kwargs.get("input", "")),
)
diff --git a/sdk/python/src/openlit/instrumentation/llamaindex/utils.py b/sdk/python/src/openlit/instrumentation/llamaindex/utils.py
index 2f170e4e..b4d31a9d 100644
--- a/sdk/python/src/openlit/instrumentation/llamaindex/utils.py
+++ b/sdk/python/src/openlit/instrumentation/llamaindex/utils.py
@@ -289,7 +289,7 @@ def common_llamaindex_logic(
)
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, str(query_text)
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, str(query_text)
)
# Query analysis
@@ -314,7 +314,7 @@ def common_llamaindex_logic(
)
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, str(query_text)
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, str(query_text)
)
# Retrieval configuration analysis
diff --git a/sdk/python/src/openlit/instrumentation/mem0/utils.py b/sdk/python/src/openlit/instrumentation/mem0/utils.py
index df135b8c..810b312d 100644
--- a/sdk/python/src/openlit/instrumentation/mem0/utils.py
+++ b/sdk/python/src/openlit/instrumentation/mem0/utils.py
@@ -137,7 +137,7 @@ def set_mem0_span_attributes(
# Batch core attributes for performance
core_attributes = {
TELEMETRY_SDK_NAME: "openlit",
- SemanticConvention.GEN_AI_SYSTEM: SemanticConvention.GEN_AI_SYSTEM_MEM0,
+ SemanticConvention.GEN_AI_PROVIDER_NAME: SemanticConvention.GEN_AI_SYSTEM_MEM0,
SemanticConvention.GEN_AI_ENDPOINT: operation_name,
DEPLOYMENT_ENVIRONMENT: ctx.environment,
SERVICE_NAME: ctx.application_name,
@@ -288,7 +288,7 @@ def set_mem0_content_attributes(
if isinstance(ctx.messages, (list, dict))
else str(ctx.messages)
)
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, content)
+ span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, content)
if response and "search" in operation_name:
content = (
@@ -296,6 +296,6 @@ def set_mem0_content_attributes(
if isinstance(response, (dict, list))
else str(response)
)
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, content)
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, content)
except Exception as e:
logger.debug("Failed to capture content: %s", e)
diff --git a/sdk/python/src/openlit/instrumentation/mistral/utils.py b/sdk/python/src/openlit/instrumentation/mistral/utils.py
index 35aa8bc2..680bb74e 100644
--- a/sdk/python/src/openlit/instrumentation/mistral/utils.py
+++ b/sdk/python/src/openlit/instrumentation/mistral/utils.py
@@ -237,22 +237,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
@@ -428,13 +428,13 @@ def common_embedding_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, str(inputs))
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, str(inputs))
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: str(inputs),
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: str(inputs),
},
)
diff --git a/sdk/python/src/openlit/instrumentation/multion/async_multion.py b/sdk/python/src/openlit/instrumentation/multion/async_multion.py
index 792c0c80..ab863af9 100644
--- a/sdk/python/src/openlit/instrumentation/multion/async_multion.py
+++ b/sdk/python/src/openlit/instrumentation/multion/async_multion.py
@@ -73,7 +73,7 @@ def async_multion_wrap(
# Set base span attribues
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_MULTION,
)
span.set_attribute(
@@ -102,7 +102,7 @@ def async_multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: kwargs.get(
"cmd", ""
),
},
@@ -110,7 +110,7 @@ def async_multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: response.message,
},
)
elif gen_ai_endpoint == "multion.retrieve":
@@ -123,7 +123,7 @@ def async_multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: kwargs.get(
"cmd", ""
),
},
@@ -131,7 +131,7 @@ def async_multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: response.message,
},
)
@@ -145,7 +145,7 @@ def async_multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: response.message,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/multion/multion.py b/sdk/python/src/openlit/instrumentation/multion/multion.py
index e5dd9876..7e99c4ce 100644
--- a/sdk/python/src/openlit/instrumentation/multion/multion.py
+++ b/sdk/python/src/openlit/instrumentation/multion/multion.py
@@ -73,7 +73,7 @@ def multion_wrap(
# Set base span attribues
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_MULTION,
)
span.set_attribute(
@@ -102,7 +102,7 @@ def multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: kwargs.get(
"cmd", ""
),
},
@@ -110,7 +110,7 @@ def multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: response.message,
},
)
elif gen_ai_endpoint == "multion.retrieve":
@@ -123,7 +123,7 @@ def multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: kwargs.get(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: kwargs.get(
"cmd", ""
),
},
@@ -131,7 +131,7 @@ def multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: response.message,
},
)
@@ -145,7 +145,7 @@ def multion_wrap(
span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: response.message,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: response.message,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/ollama/utils.py b/sdk/python/src/openlit/instrumentation/ollama/utils.py
index 183e220c..46299aa4 100644
--- a/sdk/python/src/openlit/instrumentation/ollama/utils.py
+++ b/sdk/python/src/openlit/instrumentation/ollama/utils.py
@@ -234,7 +234,7 @@ def process_chunk(self, chunk):
def record_embedding_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -252,7 +252,7 @@ def record_embedding_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -380,9 +380,9 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit OTel log event
@@ -563,9 +563,9 @@ def common_generate_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit OTel log event
@@ -690,7 +690,42 @@ def common_embedding_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt_val)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt_val)
+
+ # Emit OTel log event
+ if event_provider:
+ try:
+ # For embeddings, input is text strings, output is empty
+ if isinstance(prompt_val, str):
+ input_text = [prompt_val]
+ elif isinstance(prompt_val, list):
+ input_text = prompt_val
+ else:
+ input_text = [str(prompt_val)]
+
+ # Create simple text input messages
+ input_msgs = [
+ {"role": "user", "parts": [{"type": "text", "content": text}]}
+ for text in input_text
+ ]
+
+ emit_inference_event(
+ event_provider=event_provider,
+ operation_name=SemanticConvention.GEN_AI_OPERATION_TYPE_EMBEDDING,
+ request_model=request_model,
+ response_model=request_model,
+ input_messages=input_msgs,
+ output_messages=[], # Embeddings don't have text output
+ tool_definitions=None,
+ server_address=scope._server_address,
+ server_port=scope._server_port,
+ input_tokens=input_tokens,
+ )
+ except Exception as e:
+ import logging
+
+ logger = logging.getLogger(__name__)
+ logger.warning("Failed to emit inference event: %s", e, exc_info=True)
# Emit OTel log event
if event_provider:
diff --git a/sdk/python/src/openlit/instrumentation/openai/utils.py b/sdk/python/src/openlit/instrumentation/openai/utils.py
index 7e4f51d6..bb14d2d5 100644
--- a/sdk/python/src/openlit/instrumentation/openai/utils.py
+++ b/sdk/python/src/openlit/instrumentation/openai/utils.py
@@ -823,9 +823,9 @@ def common_response_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit inference event
@@ -1170,9 +1170,9 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Emit inference event
@@ -1431,7 +1431,7 @@ def common_embedding_logic(
else str(input_data)
)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, formatted_content
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, formatted_content
)
# Emit inference event
@@ -1596,7 +1596,7 @@ def common_image_logic(
if capture_message_content:
# Always collect the original prompt
prompt = scope._kwargs.get("prompt", "")
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
# Collect and set revised prompts if available
if images_data:
@@ -1744,7 +1744,7 @@ def common_audio_logic(
# Span Attributes for Content
if capture_message_content:
input_text = scope._kwargs.get("input", "")
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, input_text)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, input_text)
# Emit inference event
if event_provider:
diff --git a/sdk/python/src/openlit/instrumentation/openai_agents/processor.py b/sdk/python/src/openlit/instrumentation/openai_agents/processor.py
index 3c8fd0b9..957acac2 100644
--- a/sdk/python/src/openlit/instrumentation/openai_agents/processor.py
+++ b/sdk/python/src/openlit/instrumentation/openai_agents/processor.py
@@ -100,7 +100,7 @@ class OpenLITTracingProcessor(TracingProcessor):
span_name,
kind=SpanKind.CLIENT,
attributes={
- SemanticConvention.GEN_AI_SYSTEM: "openai_agents",
+ SemanticConvention.GEN_AI_PROVIDER_NAME: "openai_agents",
SemanticConvention.GEN_AI_OPERATION: SemanticConvention.GEN_AI_OPERATION_TYPE_FRAMEWORK,
"trace.id": trace_id,
"trace.name": name,
@@ -236,7 +236,7 @@ class OpenLITTracingProcessor(TracingProcessor):
kind=SpanKind.CLIENT,
context=context,
attributes={
- SemanticConvention.GEN_AI_SYSTEM: "openai_agents",
+ SemanticConvention.GEN_AI_PROVIDER_NAME: "openai_agents",
SemanticConvention.GEN_AI_OPERATION: operation_type,
"span.type": span_type,
"span.id": getattr(span_data, "span_id", ""),
diff --git a/sdk/python/src/openlit/instrumentation/premai/utils.py b/sdk/python/src/openlit/instrumentation/premai/utils.py
index 427c9d91..532acda8 100644
--- a/sdk/python/src/openlit/instrumentation/premai/utils.py
+++ b/sdk/python/src/openlit/instrumentation/premai/utils.py
@@ -185,22 +185,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed one the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
@@ -284,7 +284,7 @@ def common_embedding_logic(
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: str(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: str(
scope._kwargs.get("input", "")
),
},
diff --git a/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.py b/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.py
index 8a8666ac..45620b3c 100644
--- a/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.py
+++ b/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.py
@@ -194,7 +194,8 @@ def set_span_attributes(
span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, operation_name)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_PYDANTIC_AI
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
+ SemanticConvention.GEN_AI_SYSTEM_PYDANTIC_AI,
)
# Set agent name if meaningful
@@ -249,7 +250,7 @@ def add_message_tracking(span, messages: List[Dict], message_type: str = "input"
# Set message attributes
if message_type == "input":
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, json.dumps(formatted_messages)
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, json.dumps(formatted_messages)
)
else:
span.set_attribute(
@@ -318,7 +319,7 @@ def execute_with_error_handling(
# Add completion content if requested
if capture_completion and hasattr(response, "data"):
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, str(response.data)
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, str(response.data)
)
span.set_status(Status(StatusCode.OK))
@@ -461,7 +462,7 @@ def add_business_intelligence_attributes(
# Enhanced content capture
if capture_message_content and hasattr(response, "output") and response.output:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, str(response.output)
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, str(response.output)
)
except Exception as e:
@@ -789,7 +790,7 @@ def common_internal_node(
# Set basic attributes
span.set_attribute(SemanticConvention.GEN_AI_OPERATION, operation_type)
span.set_attribute(
- SemanticConvention.GEN_AI_SYSTEM,
+ SemanticConvention.GEN_AI_PROVIDER_NAME,
SemanticConvention.GEN_AI_SYSTEM_PYDANTIC_AI,
)
span.set_attribute(SemanticConvention.GEN_AI_SDK_VERSION, version)
@@ -816,7 +817,7 @@ def common_internal_node(
)
if context_info["user_input"]:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, context_info["user_input"]
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, context_info["user_input"]
)
if context_info["tool_info"]:
span.set_attribute(
diff --git a/sdk/python/src/openlit/instrumentation/reka/utils.py b/sdk/python/src/openlit/instrumentation/reka/utils.py
index a6eee345..5ff4658b 100644
--- a/sdk/python/src/openlit/instrumentation/reka/utils.py
+++ b/sdk/python/src/openlit/instrumentation/reka/utils.py
@@ -143,22 +143,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed one the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/sarvam/utils.py b/sdk/python/src/openlit/instrumentation/sarvam/utils.py
index c21f6b94..26850db5 100644
--- a/sdk/python/src/openlit/instrumentation/sarvam/utils.py
+++ b/sdk/python/src/openlit/instrumentation/sarvam/utils.py
@@ -224,10 +224,10 @@ def common_chat_logic(
# Set span attributes for prompts and generations
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, formatted_messages
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, formatted_messages
)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# Record metrics
@@ -235,7 +235,7 @@ def common_chat_logic(
record_completion_metrics(
metrics=metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_CHAT,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
server_address=scope._server_address,
server_port=scope._server_port,
request_model=request_model,
@@ -485,7 +485,7 @@ def process_translate_response(
# Translation response attributes
if response_dict.get("translated_text"):
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
response_dict.get("translated_text"),
)
@@ -504,7 +504,7 @@ def process_translate_response(
# Set content attributes if capture is enabled
if capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, kwargs.get("input", "")
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, kwargs.get("input", "")
)
span.set_status(Status(StatusCode.OK))
@@ -521,7 +521,7 @@ def process_translate_response(
record_completion_metrics(
metrics=metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_TRANSLATE,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -626,7 +626,7 @@ def process_speech_to_text_response(
# Speech-to-text response attributes
if response_dict.get("transcript"):
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
response_dict.get("transcript"),
)
@@ -660,7 +660,7 @@ def process_speech_to_text_response(
# Set content attributes if capture is enabled
if capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, kwargs.get("file", "audio_file")
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, kwargs.get("file", "audio_file")
)
span.set_status(Status(StatusCode.OK))
@@ -675,7 +675,7 @@ def process_speech_to_text_response(
record_audio_metrics(
metrics=metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_SPEECH_TO_TEXT,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -793,7 +793,7 @@ def process_text_to_speech_response(
# Set content attributes if capture is enabled
if capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, kwargs.get("inputs", "")
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, kwargs.get("inputs", "")
)
span.set_status(Status(StatusCode.OK))
@@ -807,7 +807,7 @@ def process_text_to_speech_response(
record_audio_metrics(
metrics=metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_TEXT_TO_SPEECH,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -915,7 +915,7 @@ def process_transliterate_response(
# Transliterate response attributes
if response_dict.get("transliterated_text"):
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
response_dict.get("transliterated_text"),
)
@@ -934,7 +934,7 @@ def process_transliterate_response(
# Set content attributes if capture is enabled
if capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, kwargs.get("input", "")
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, kwargs.get("input", "")
)
span.set_status(Status(StatusCode.OK))
@@ -951,7 +951,7 @@ def process_transliterate_response(
record_completion_metrics(
metrics=metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_TRANSLITERATE,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -1057,14 +1057,14 @@ def process_language_identification_response(
# Set content attributes if capture is enabled
if capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, kwargs.get("input", "")
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, kwargs.get("input", "")
)
# For language identification, the "completion" would be the detected language/script
detected_info = (
f"Language: {response_dict.get('language_code', 'unknown')}, "
f"Script: {response_dict.get('script_code', 'unknown')}"
)
- span.set_attribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, detected_info)
+ span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, detected_info)
span.set_status(Status(StatusCode.OK))
@@ -1077,7 +1077,7 @@ def process_language_identification_response(
record_completion_metrics(
metrics=metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_LANGUAGE_IDENTIFICATION,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -1170,7 +1170,7 @@ def process_speech_to_text_translate_response(
# Speech-to-text translate response attributes
if response_dict.get("transcript"):
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
response_dict.get("transcript"),
)
@@ -1198,7 +1198,7 @@ def process_speech_to_text_translate_response(
# Set content attributes if capture is enabled
if capture_message_content:
span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, kwargs.get("file", "audio_file")
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, kwargs.get("file", "audio_file")
)
span.set_status(Status(StatusCode.OK))
@@ -1213,7 +1213,7 @@ def process_speech_to_text_translate_response(
record_audio_metrics(
metrics=metrics,
gen_ai_operation=SemanticConvention.GEN_AI_OPERATION_TYPE_SPEECH_TO_TEXT_TRANSLATE,
- gen_ai_system=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
+ GEN_AI_PROVIDER_NAME=SemanticConvention.GEN_AI_SYSTEM_SARVAM,
server_address=server_address,
server_port=server_port,
request_model=request_model,
diff --git a/sdk/python/src/openlit/instrumentation/together/utils.py b/sdk/python/src/openlit/instrumentation/together/utils.py
index 0c5c594b..4e929c95 100644
--- a/sdk/python/src/openlit/instrumentation/together/utils.py
+++ b/sdk/python/src/openlit/instrumentation/together/utils.py
@@ -81,7 +81,7 @@ def process_chunk(scope, chunk):
def common_span_attributes(
scope,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -99,7 +99,9 @@ def common_span_attributes(
scope._span.set_attribute(TELEMETRY_SDK_NAME, "openlit")
scope._span.set_attribute(SemanticConvention.GEN_AI_OPERATION, gen_ai_operation)
- scope._span.set_attribute(SemanticConvention.GEN_AI_SYSTEM, gen_ai_system)
+ scope._span.set_attribute(
+ SemanticConvention.GEN_AI_PROVIDER_NAME, GEN_AI_PROVIDER_NAME
+ )
scope._span.set_attribute(SemanticConvention.SERVER_ADDRESS, server_address)
scope._span.set_attribute(SemanticConvention.SERVER_PORT, server_port)
scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_MODEL, request_model)
@@ -115,7 +117,7 @@ def common_span_attributes(
def record_common_metrics(
metrics,
gen_ai_operation,
- gen_ai_system,
+ GEN_AI_PROVIDER_NAME,
server_address,
server_port,
request_model,
@@ -136,7 +138,7 @@ def record_common_metrics(
attributes = create_metrics_attributes(
operation=gen_ai_operation,
- system=gen_ai_system,
+ system=GEN_AI_PROVIDER_NAME,
server_address=server_address,
server_port=server_port,
request_model=request_model,
@@ -263,22 +265,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed one the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
@@ -460,7 +462,7 @@ def common_image_logic(
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: scope._kwargs.get(
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: scope._kwargs.get(
"prompt", ""
),
},
@@ -473,7 +475,7 @@ def common_image_logic(
scope._span.add_event(
name=attribute_name,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: getattr(
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: getattr(
item, image_format
),
},
diff --git a/sdk/python/src/openlit/instrumentation/transformers/utils.py b/sdk/python/src/openlit/instrumentation/transformers/utils.py
index ebc7156a..4acf7029 100644
--- a/sdk/python/src/openlit/instrumentation/transformers/utils.py
+++ b/sdk/python/src/openlit/instrumentation/transformers/utils.py
@@ -141,23 +141,23 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_PROMPT, scope._prompt
+ SemanticConvention.GEN_AI_INPUT_MESSAGES, scope._prompt
)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._completion
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._completion
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: scope._prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: scope._prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._completion,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._completion,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/vertexai/utils.py b/sdk/python/src/openlit/instrumentation/vertexai/utils.py
index 15373c4f..1ecacfcb 100644
--- a/sdk/python/src/openlit/instrumentation/vertexai/utils.py
+++ b/sdk/python/src/openlit/instrumentation/vertexai/utils.py
@@ -163,22 +163,22 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, scope._llmresponse
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES, scope._llmresponse
)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: scope._llmresponse,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: scope._llmresponse,
},
)
diff --git a/sdk/python/src/openlit/instrumentation/vllm/utils.py b/sdk/python/src/openlit/instrumentation/vllm/utils.py
index 15bdf042..b58a01f1 100644
--- a/sdk/python/src/openlit/instrumentation/vllm/utils.py
+++ b/sdk/python/src/openlit/instrumentation/vllm/utils.py
@@ -138,22 +138,20 @@ def common_chat_logic(
# Span Attributes for Content
if capture_message_content:
- scope._span.set_attribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt)
- scope._span.set_attribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION, completion
- )
+ scope._span.set_attribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt)
+ scope._span.set_attribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, completion)
# To be removed once the change to span_attributes (from span events) is complete
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_PROMPT_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_PROMPT: prompt,
+ SemanticConvention.GEN_AI_INPUT_MESSAGES: prompt,
},
)
scope._span.add_event(
name=SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT,
attributes={
- SemanticConvention.GEN_AI_CONTENT_COMPLETION: completion,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES: completion,
},
)
diff --git a/sdk/python/src/openlit/semcov/__init__.py b/sdk/python/src/openlit/semcov/__init__.py
index d4ac5e37..9788012d 100644
--- a/sdk/python/src/openlit/semcov/__init__.py
+++ b/sdk/python/src/openlit/semcov/__init__.py
@@ -51,7 +51,7 @@ class SemanticConvention:
# GenAI Request Attributes (OTel Semconv)
GEN_AI_OPERATION = "gen_ai.operation.name"
- GEN_AI_SYSTEM = "gen_ai.system"
+ GEN_AI_PROVIDER_NAME = "gen_ai.provider.name"
GEN_AI_OUTPUT_TYPE = "gen_ai.output.type"
GEN_AI_ENDPOINT = "gen_ai.endpoint"
GEN_AI_REQUEST_MODEL = "gen_ai.request.model"
@@ -337,9 +337,9 @@ class SemanticConvention:
# GenAI Content
GEN_AI_CONTENT_PROMPT_EVENT = "gen_ai.content.prompt"
- GEN_AI_CONTENT_PROMPT = "gen_ai.prompt"
+ GEN_AI_INPUT_MESSAGES = "gen_ai.input.messages"
GEN_AI_CONTENT_COMPLETION_EVENT = "gen_ai.content.completion"
- GEN_AI_CONTENT_COMPLETION = "gen_ai.completion"
+ GEN_AI_OUTPUT_MESSAGES = "gen_ai.output.messages"
GEN_AI_CONTENT_REVISED_PROMPT = "gen_ai.content.revised_prompt"
GEN_AI_CONTENT_REASONING = "gen_ai.content.reasoning"
@@ -955,7 +955,7 @@ class SemanticConvention:
# === ENHANCED SEMANTIC CONVENTIONS FOR COMPREHENSIVE INSTRUMENTATION ===
# Message structure attributes (reuse existing prompt for input, add output messages)
- # Note: For input messages, we reuse GEN_AI_CONTENT_PROMPT for consistency
+ # Note: For input messages, we reuse GEN_AI_INPUT_MESSAGES for consistency
GEN_AI_OUTPUT_MESSAGES = "gen_ai.output_messages"
GEN_AI_MESSAGE_ROLE = "gen_ai.message.role"
GEN_AI_MESSAGE_CONTENT = "gen_ai.message.content"
diff --git a/sdk/typescript/src/instrumentation/__tests__/base-wrapper.test.ts b/sdk/typescript/src/instrumentation/__tests__/base-wrapper.test.ts
index 8958b9b6..5e20134f 100644
--- a/sdk/typescript/src/instrumentation/__tests__/base-wrapper.test.ts
+++ b/sdk/typescript/src/instrumentation/__tests__/base-wrapper.test.ts
@@ -65,7 +65,7 @@ describe('BaseWrapper.setBaseSpanAttributes', () => {
expect(span.setAttribute).toHaveBeenCalledWith(SemanticConvention.GEN_AI_USAGE_COST, 0.99);
expect(span.setStatus).toHaveBeenCalled();
expect(Metrics.genaiRequests!.add).toHaveBeenCalledWith(1, expect.objectContaining({
- [SemanticConvention.GEN_AI_SYSTEM]: 'openai',
+ [SemanticConvention.GEN_AI_PROVIDER_NAME]: 'openai',
[SemanticConvention.GEN_AI_REQUEST_USER]: 'user1',
[SemanticConvention.GEN_AI_REQUEST_MODEL]: 'gpt-4',
}));
diff --git a/sdk/typescript/src/instrumentation/anthropic/wrapper.ts b/sdk/typescript/src/instrumentation/anthropic/wrapper.ts
index 640a6616..28d6ecdf 100644
--- a/sdk/typescript/src/instrumentation/anthropic/wrapper.ts
+++ b/sdk/typescript/src/instrumentation/anthropic/wrapper.ts
@@ -238,7 +238,7 @@ export default class AnthropicWrapper extends BaseWrapper {
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, stream);
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_SEED, seed);
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt);
}
// Request Params attributes : End
@@ -255,7 +255,7 @@ export default class AnthropicWrapper extends BaseWrapper {
if (traceContent) {
span.setAttribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
result.content?.[0]?.text || ''
);
}
diff --git a/sdk/typescript/src/instrumentation/base-wrapper.ts b/sdk/typescript/src/instrumentation/base-wrapper.ts
index 7c7182ae..e07c9de3 100644
--- a/sdk/typescript/src/instrumentation/base-wrapper.ts
+++ b/sdk/typescript/src/instrumentation/base-wrapper.ts
@@ -33,7 +33,7 @@ export default class BaseWrapper {
});
span.setAttribute(TELEMETRY_SDK_NAME, SDK_NAME);
- span.setAttribute(SemanticConvention.GEN_AI_SYSTEM, aiSystem);
+ span.setAttribute(SemanticConvention.GEN_AI_PROVIDER_NAME, aiSystem);
span.setAttribute(SemanticConvention.GEN_AI_ENDPOINT, genAIEndpoint);
span.setAttribute(SemanticConvention.GEN_AI_ENVIRONMENT, environment);
span.setAttribute(SemanticConvention.GEN_AI_APPLICATION_NAME, applicationName);
@@ -57,7 +57,7 @@ export default class BaseWrapper {
const duration = BaseWrapper.getSpanAttribute(span, 'duration') ?? BaseWrapper.getSpanAttribute(span, 'gen_ai.duration');
const attributes = {
[ATTR_SERVICE_NAME]: applicationName,
- [SemanticConvention.GEN_AI_SYSTEM]: aiSystem,
+ [SemanticConvention.GEN_AI_PROVIDER_NAME]: aiSystem,
[SemanticConvention.GEN_AI_ENDPOINT]: genAIEndpoint,
[SemanticConvention.ATTR_DEPLOYMENT_ENVIRONMENT]: environment,
[SemanticConvention.GEN_AI_REQUEST_MODEL]: model,
diff --git a/sdk/typescript/src/instrumentation/cohere/wrapper.ts b/sdk/typescript/src/instrumentation/cohere/wrapper.ts
index 59da5013..6570aa34 100644
--- a/sdk/typescript/src/instrumentation/cohere/wrapper.ts
+++ b/sdk/typescript/src/instrumentation/cohere/wrapper.ts
@@ -48,7 +48,7 @@ export default class CohereWrapper extends BaseWrapper {
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_ENCODING_FORMATS, encoding_format);
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_EMBEDDING_DIMENSION, dimensions);
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, JSON.stringify(texts));
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, JSON.stringify(texts));
}
// Request Params attributes : End
span.setAttribute(SemanticConvention.GEN_AI_RESPONSE_ID, response.id);
@@ -239,7 +239,7 @@ export default class CohereWrapper extends BaseWrapper {
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, stream);
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, message);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, message);
}
// Request Params attributes : End
@@ -283,10 +283,10 @@ export default class CohereWrapper extends BaseWrapper {
}
if (tools) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, 'Function called with tools');
+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, 'Function called with tools');
} else {
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, result.text);
+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, result.text);
}
}
diff --git a/sdk/typescript/src/instrumentation/ollama/wrapper.ts b/sdk/typescript/src/instrumentation/ollama/wrapper.ts
index d27539df..82ca1fcd 100644
--- a/sdk/typescript/src/instrumentation/ollama/wrapper.ts
+++ b/sdk/typescript/src/instrumentation/ollama/wrapper.ts
@@ -15,7 +15,7 @@ export default class OllamaWrapper extends BaseWrapper {
});
span.setAttribute(TELEMETRY_SDK_NAME, SDK_NAME);
- span.setAttribute(SemanticConvention.GEN_AI_SYSTEM, SemanticConvention.GEN_AI_SYSTEM_ANTHROPIC);
+ span.setAttribute(SemanticConvention.GEN_AI_PROVIDER_NAME, SemanticConvention.GEN_AI_SYSTEM_ANTHROPIC);
span.setAttribute(SemanticConvention.GEN_AI_ENDPOINT, genAIEndpoint);
span.setAttribute(SemanticConvention.GEN_AI_ENVIRONMENT, environment);
span.setAttribute(SemanticConvention.GEN_AI_APPLICATION_NAME, applicationName);
@@ -248,7 +248,7 @@ export default class OllamaWrapper extends BaseWrapper {
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, stream);
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_SEED, seed);
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt);
}
// Request Params attributes : End
@@ -264,7 +264,7 @@ export default class OllamaWrapper extends BaseWrapper {
// Format 'messages' into a single string
const { message = {} } = result;
const messageString = `${message.role}: ${message.content}`;
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, messageString);
+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, messageString);
}
}
}
diff --git a/sdk/typescript/src/instrumentation/openai/wrapper.ts b/sdk/typescript/src/instrumentation/openai/wrapper.ts
index 5f9bf143..d4943710 100644
--- a/sdk/typescript/src/instrumentation/openai/wrapper.ts
+++ b/sdk/typescript/src/instrumentation/openai/wrapper.ts
@@ -311,7 +311,7 @@ class OpenAIWrapper extends BaseWrapper {
}
const prompt = formattedMessages.join('\n');
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt);
}
// Request Params attributes : End
@@ -449,13 +449,13 @@ class OpenAIWrapper extends BaseWrapper {
if (n === 1) {
span.setAttribute(
- SemanticConvention.GEN_AI_CONTENT_COMPLETION,
+ SemanticConvention.GEN_AI_OUTPUT_MESSAGES,
completionContent
);
} else {
let i = 0;
while (i < n) {
- const attribute_name = `${SemanticConvention.GEN_AI_CONTENT_COMPLETION}.${i}`;
+ const attribute_name = `${SemanticConvention.GEN_AI_OUTPUT_MESSAGES}.${i}`;
span.setAttribute(attribute_name, result.choices[i].message.content || '');
i += 1;
}
@@ -463,7 +463,7 @@ class OpenAIWrapper extends BaseWrapper {
// Add events for backward compatibility
span.addEvent(SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT, {
- [SemanticConvention.GEN_AI_CONTENT_COMPLETION]: completionContent,
+ [SemanticConvention.GEN_AI_OUTPUT_MESSAGES]: completionContent,
});
}
@@ -529,7 +529,7 @@ class OpenAIWrapper extends BaseWrapper {
}
if (traceContent) {
const formattedInput = typeof input === 'string' ? input : JSON.stringify(input);
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, formattedInput);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, formattedInput);
}
// Request Params attributes : End
@@ -699,7 +699,7 @@ class OpenAIWrapper extends BaseWrapper {
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IMAGE_STYLE, style);
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt);
}
// Request Params attributes : End
@@ -792,7 +792,7 @@ class OpenAIWrapper extends BaseWrapper {
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_IMAGE_STYLE, style);
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt);
}
// Request Params attributes : End
@@ -877,7 +877,7 @@ class OpenAIWrapper extends BaseWrapper {
span.setAttribute(SemanticConvention.GEN_AI_REQUEST_AUDIO_SPEED, speed);
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, input);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, input);
}
// Request Params attributes : End
@@ -1150,7 +1150,7 @@ class OpenAIWrapper extends BaseWrapper {
}
if (traceContent) {
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_PROMPT, prompt);
+ span.setAttribute(SemanticConvention.GEN_AI_INPUT_MESSAGES, prompt);
}
span.setAttribute(
@@ -1252,11 +1252,11 @@ class OpenAIWrapper extends BaseWrapper {
// Content
if (traceContent) {
// Set completion content - use actual text or empty string if only tool calls
- span.setAttribute(SemanticConvention.GEN_AI_CONTENT_COMPLETION, completionText);
+ span.setAttribute(SemanticConvention.GEN_AI_OUTPUT_MESSAGES, completionText);
// Add events for backward compatibility
span.addEvent(SemanticConvention.GEN_AI_CONTENT_COMPLETION_EVENT, {
- [SemanticConvention.GEN_AI_CONTENT_COMPLETION]: completionText,
+ [SemanticConvention.GEN_AI_OUTPUT_MESSAGES]: completionText,
});
}
diff --git a/sdk/typescript/src/otel/__tests__/metrics.test.ts b/sdk/typescript/src/otel/__tests__/metrics.test.ts
index 14545235..659983cb 100644
--- a/sdk/typescript/src/otel/__tests__/metrics.test.ts
+++ b/sdk/typescript/src/otel/__tests__/metrics.test.ts
@@ -11,31 +11,31 @@ describe('Metrics creation', () => {
it('should create genaiRequests counter and allow increment', () => {
expect(Metrics.genaiRequests).toBeDefined();
expect(typeof Metrics.genaiRequests.add).toBe('function');
- expect(() => Metrics.genaiRequests.add(1, { [SemanticConvention.GEN_AI_SYSTEM]: 'openai' })).not.toThrow();
+ expect(() => Metrics.genaiRequests.add(1, { [SemanticConvention.GEN_AI_PROVIDER_NAME]: 'openai' })).not.toThrow();
});
it('should create genaiPromptTokens counter and allow increment', () => {
expect(Metrics.genaiPromptTokens).toBeDefined();
expect(typeof Metrics.genaiPromptTokens.add).toBe('function');
- expect(() => Metrics.genaiPromptTokens.add(42, { [SemanticConvention.GEN_AI_SYSTEM]: 'openai' })).not.toThrow();
+ expect(() => Metrics.genaiPromptTokens.add(42, { [SemanticConvention.GEN_AI_PROVIDER_NAME]: 'openai' })).not.toThrow();
});
it('should create genaiCompletionTokens counter and allow increment', () => {
expect(Metrics.genaiCompletionTokens).toBeDefined();
expect(typeof Metrics.genaiCompletionTokens.add).toBe('function');
- expect(() => Metrics.genaiCompletionTokens.add(24, { [SemanticConvention.GEN_AI_SYSTEM]: 'openai' })).not.toThrow();
+ expect(() => Metrics.genaiCompletionTokens.add(24, { [SemanticConvention.GEN_AI_PROVIDER_NAME]: 'openai' })).not.toThrow();
});
it('should create genaiClientOperationDuration histogram and allow record', () => {
expect(Metrics.genaiClientOperationDuration).toBeDefined();
expect(typeof Metrics.genaiClientOperationDuration.record).toBe('function');
- expect(() => Metrics.genaiClientOperationDuration.record(1.23, { [SemanticConvention.GEN_AI_SYSTEM]: 'openai' })).not.toThrow();
+ expect(() => Metrics.genaiClientOperationDuration.record(1.23, { [SemanticConvention.GEN_AI_PROVIDER_NAME]: 'openai' })).not.toThrow();
});
it('should create genaiCost histogram and allow record', () => {
expect(Metrics.genaiCost).toBeDefined();
expect(typeof Metrics.genaiCost.record).toBe('function');
- expect(() => Metrics.genaiCost.record(0.99, { [SemanticConvention.GEN_AI_SYSTEM]: 'openai' })).not.toThrow();
+ expect(() => Metrics.genaiCost.record(0.99, { [SemanticConvention.GEN_AI_PROVIDER_NAME]: 'openai' })).not.toThrow();
});
it('should throw an error when allowConsoleExporterFallback is not set and fallback is required', () => {
diff --git a/sdk/typescript/src/semantic-convention.ts b/sdk/typescript/src/semantic-convention.ts
index a67ef121..8855cba7 100644
--- a/sdk/typescript/src/semantic-convention.ts
+++ b/sdk/typescript/src/semantic-convention.ts
@@ -3,7 +3,7 @@ export default class SemanticConvention {
static ATTR_DEPLOYMENT_ENVIRONMENT = 'deployment.environment'
// GenAI General
static GEN_AI_ENDPOINT = 'gen_ai.endpoint';
- static GEN_AI_SYSTEM = 'gen_ai.system';
+ static GEN_AI_PROVIDER_NAME = 'gen_ai.system';
static GEN_AI_ENVIRONMENT = 'gen_ai.environment';
static GEN_AI_APPLICATION_NAME = 'gen_ai.application_name';
static GEN_AI_OPERATION = 'gen_ai.operation.name';
@@ -73,9 +73,9 @@ export default class SemanticConvention {
static GEN_AI_RESPONSE_SYSTEM_FINGERPRINT = 'gen_ai.response.system_fingerprint';
// GenAI Content
- static GEN_AI_CONTENT_PROMPT = 'gen_ai.prompt';
+ static GEN_AI_INPUT_MESSAGES = 'gen_ai.prompt';
static GEN_AI_CONTENT_PROMPT_EVENT = 'gen_ai.content.prompt';
- static GEN_AI_CONTENT_COMPLETION = 'gen_ai.completion';
+ static GEN_AI_OUTPUT_MESSAGES = 'gen_ai.completion';
static GEN_AI_CONTENT_COMPLETION_EVENT = 'gen_ai.content.completion';
static GEN_AI_CONTENT_REVISED_PROMPT = 'gen_ai.content.revised_prompt';