Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
Fix: Invalid type NoneType for span attributes in Agno and wrong type of model name in pydantic-ai (#903)
Patchera54cfe6c9bce
diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.tomlindex 8979e09d..7596d9df 100644--- a/sdk/python/pyproject.toml+++ b/sdk/python/pyproject.toml@@ -1,6 +1,6 @@[tool.poetry]name = "openlit"-version = "1.35.7"+version = "1.35.8"description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects"authors = ["OpenLIT"]license = "Apache-2.0"diff --git a/sdk/python/src/openlit/__helpers.py b/sdk/python/src/openlit/__helpers.pyindex e44d560d..b241cafe 100644--- a/sdk/python/src/openlit/__helpers.py+++ b/sdk/python/src/openlit/__helpers.py@@ -428,7 +428,8 @@ def common_span_attributes(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)- scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, response_model)+ if response_model:+ scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_MODEL, response_model)scope._span.set_attribute(DEPLOYMENT_ENVIRONMENT, environment)scope._span.set_attribute(SERVICE_NAME, application_name)scope._span.set_attribute(SemanticConvention.GEN_AI_REQUEST_IS_STREAM, is_stream)diff --git a/sdk/python/src/openlit/instrumentation/openai/utils.py b/sdk/python/src/openlit/instrumentation/openai/utils.pyindex 940de6ec..ca1cfdff 100644--- a/sdk/python/src/openlit/instrumentation/openai/utils.py+++ b/sdk/python/src/openlit/instrumentation/openai/utils.py@@ -235,8 +235,8 @@ def process_response_chunk(scope, chunk):elif chunked.get("type") == "response.completed":response_data = chunked.get("response", {})- scope._response_id = response_data.get("id")- scope._response_model = response_data.get("model")+ scope._response_id = response_data.get("id") or scope._response_id+ scope._response_model = response_data.get("model") or scope._response_modelscope._finish_reason = response_data.get("status")usage = response_data.get("usage", {})@@ -328,7 +328,8 @@ def common_response_logic()# Span Attributes for Response parameters- scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID, scope._response_id)+ if scope._response_id:+ scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID, scope._response_id)scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [scope._finish_reason])@@ -516,8 +517,8 @@ def process_response_response(if content and len(content) > 0:scope._llmresponse = content[0].get("text", "")- scope._response_id = response_dict.get("id")- scope._response_model = response_dict.get("model")+ scope._response_id = response_dict.get("id", "")+ scope._response_model = response_dict.get("model", "")# Handle token usage including reasoning tokensusage = response_dict.get("usage", {})@@ -641,7 +642,8 @@ def common_chat_logic()# Span Attributes for Response parameters- scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID, scope._response_id)+ if scope._response_id:+ scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_ID, scope._response_id)scope._span.set_attribute(SemanticConvention.GEN_AI_RESPONSE_FINISH_REASON, [scope._finish_reason])@@ -805,8 +807,8 @@ def process_chat_response((choice.get("message", {}).get("content") or "")for choice in response_dict.get("choices", []))- scope._response_id = response_dict.get("id")- scope._response_model = response_dict.get("model")+ scope._response_id = response_dict.get("id", "")+ scope._response_model = response_dict.get("model", "")scope._input_tokens = response_dict.get("usage", {}).get("prompt_tokens", 0)scope._output_tokens = response_dict.get("usage", {}).get("completion_tokens", 0)scope._timestamps = []diff --git a/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.py b/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.pyindex e283bfc5..8a8666ac 100644--- a/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.py+++ b/sdk/python/src/openlit/instrumentation/pydantic_ai/utils.py@@ -633,13 +633,19 @@ def common_agent_create(args[0] if args else kwargs.get("model", "google-gla:gemini-1.5-flash"))+ # Extract model_name if request_model is a model object+ if hasattr(request_model, "model_name"):+ model_name_str = str(request_model.model_name)+ else:+ model_name_str = str(request_model)+# Create a minimal context object for creationclass CreateContext:"""Minimal context for agent creation instrumentation."""def __init__(self):self.agent_name = agent_name- self.model_name = request_model+ self.model_name = model_name_strself.server_info = ("127.0.0.1", 80)self.environment = environmentself.application_name = application_name@@ -675,7 +681,7 @@ def common_agent_create(SemanticConvention.GEN_AI_AGENT_DESCRIPTION: str(kwargs.get("system_prompt", "")),- SemanticConvention.GEN_AI_RESPONSE_MODEL: request_model,+ SemanticConvention.GEN_AI_RESPONSE_MODEL: model_name_str,},)