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(
6060 # TODO: clean provider name to match GenAiProviderNameValues?
6161 span .set_attribute (GenAI .GEN_AI_PROVIDER_NAME , provider )
6262
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 ]
6664 if finish_reasons :
6765 span .set_attribute (
6866 GenAI .GEN_AI_RESPONSE_FINISH_REASONS , finish_reasons
Original file line number Diff line number Diff line change 2323
2424from opentelemetry .context import Context
2525from opentelemetry .trace import Span
26- from opentelemetry .util .types import AttributeValue
2726
2827ContextToken : TypeAlias = Token [Context ]
2928
@@ -115,8 +114,8 @@ class LLMInvocation:
115114 provider : Optional [str ] = None
116115 response_model_name : Optional [str ] = None
117116 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
120119 attributes : Dict [str , Any ] = field (default_factory = _new_str_any_dict )
121120
122121
You can’t perform that action at this time.
0 commit comments