Skip to content

Commit 34efa83

Browse files
committed
types
1 parent 3b147f8 commit 34efa83

File tree

1 file changed

+5
-3
lines changed
  • python/instrumentation/openinference-instrumentation-smolagents/src/openinference/instrumentation/smolagents

1 file changed

+5
-3
lines changed

python/instrumentation/openinference-instrumentation-smolagents/src/openinference/instrumentation/smolagents/_wrappers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from opentelemetry import context as context_api
66
from opentelemetry import trace as trace_api
7+
from opentelemetry.sdk.trace import ReadableSpan
78
from opentelemetry.util.types import AttributeValue
89

910
import openinference.instrumentation as oi
@@ -433,9 +434,10 @@ def _has_active_llm_parent_span() -> bool:
433434
"""
434435
current_span = trace_api.get_current_span()
435436
return (
436-
current_span.is_recording
437-
and current_span.get_span_context().is_valid
438-
and current_span.attributes.get(OPENINFERENCE_SPAN_KIND) == LLM
437+
current_span.get_span_context().is_valid
438+
and current_span.is_recording()
439+
and isinstance(current_span, ReadableSpan)
440+
and (current_span.attributes or {}).get(OPENINFERENCE_SPAN_KIND) == LLM
439441
)
440442

441443

0 commit comments

Comments
 (0)