File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed
util/opentelemetry-util-genai/src/opentelemetry/util/genai Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -60,9 +60,7 @@ def _apply_common_span_attributes(
60
60
# TODO: clean provider name to match GenAiProviderNameValues?
61
61
span .set_attribute (GenAI .GEN_AI_PROVIDER_NAME , provider )
62
62
63
- finish_reasons : List [str ] = []
64
- for gen in invocation .output_messages :
65
- finish_reasons .append (gen .finish_reason )
63
+ finish_reasons = [gen .finish_reason for gen in invocation .output_messages ]
66
64
if finish_reasons :
67
65
span .set_attribute (
68
66
GenAI .GEN_AI_RESPONSE_FINISH_REASONS , finish_reasons
Original file line number Diff line number Diff line change 23
23
24
24
from opentelemetry .context import Context
25
25
from opentelemetry .trace import Span
26
- from opentelemetry .util .types import AttributeValue
27
26
28
27
ContextToken : TypeAlias = Token [Context ]
29
28
@@ -115,8 +114,8 @@ class LLMInvocation:
115
114
provider : Optional [str ] = None
116
115
response_model_name : Optional [str ] = None
117
116
response_id : Optional [str ] = None
118
- input_tokens : Optional [AttributeValue ] = None
119
- output_tokens : Optional [AttributeValue ] = None
117
+ input_tokens : Optional [int ] = None
118
+ output_tokens : Optional [int ] = None
120
119
attributes : Dict [str , Any ] = field (default_factory = _new_str_any_dict )
121
120
122
121
You can’t perform that action at this time.
0 commit comments