Skip to content

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

fix(google_ai_studio): add missing GEN_AI_USAGE_REASONING_TOKENS semconv (#1137)

Saivedant Hava2c403d28af4b
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 7ac127e2..5de255b5 100644
--- a/sdk/python/src/openlit/instrumentation/google_ai_studio/utils.py
+++ b/sdk/python/src/openlit/instrumentation/google_ai_studio/utils.py
@@ -600,7 +600,8 @@ def common_chat_logic(
and scope._reasoning_tokens > 0
):
scope._span.set_attribute(
- "gen_ai.usage.reasoning_tokens", scope._reasoning_tokens
+ SemanticConvention.GEN_AI_USAGE_REASONING_TOKENS,
+ scope._reasoning_tokens,
)
# OTel cached token attributes (set even when 0)
diff --git a/sdk/python/src/openlit/semcov/__init__.py b/sdk/python/src/openlit/semcov/__init__.py
index 372663db..aaa7496e 100644
--- a/sdk/python/src/openlit/semcov/__init__.py
+++ b/sdk/python/src/openlit/semcov/__init__.py
@@ -569,6 +569,7 @@ class SemanticConvention:
GEN_AI_USAGE_COMPLETION_TOKENS_DETAILS_REASONING = (
"gen_ai.usage.completion_tokens_details.reasoning_tokens"
)
+ GEN_AI_USAGE_REASONING_TOKENS = "gen_ai.usage.reasoning_tokens"
GEN_AI_USAGE_PROMPT_TOKENS_DETAILS_CACHE_READ = (
"gen_ai.usage.prompt_tokens_details.cached_tokens"
)