File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
util/opentelemetry-util-genai/src/opentelemetry/util/genai Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 7070 get_logger ,
7171)
7272from opentelemetry .metrics import MeterProvider , get_meter
73- from opentelemetry .semconv ._incubating .attributes import (
74- gen_ai_attributes as GenAI ,
75- )
7673from opentelemetry .semconv .schemas import Schemas
7774from opentelemetry .trace import (
7875 Span ,
@@ -141,7 +138,7 @@ def start_llm(
141138 """Start an LLM invocation and create a pending span entry."""
142139 # Create a span and attach it as current; keep the token to detach later
143140 span = self ._tracer .start_span (
144- name = f"{ GenAI . GenAiOperationNameValues . CHAT . value } { invocation .request_model } " ,
141+ name = f"{ invocation . operation_name } { invocation .request_model } " ,
145142 kind = SpanKind .CLIENT ,
146143 )
147144 # Record a monotonic start timestamp (seconds) for duration
Original file line number Diff line number Diff line change 2424from opentelemetry .context import Context
2525from opentelemetry .trace import Span
2626
27+ from opentelemetry .semconv ._incubating .attributes import (
28+ gen_ai_attributes as GenAI ,
29+ )
30+
2731ContextToken : TypeAlias = Token [Context ]
2832
2933
@@ -182,6 +186,8 @@ class LLMInvocation:
182186 """
183187
184188 request_model : str
189+ # Chat by default
190+ operation_name : str = GenAI .GenAiOperationNameValues .CHAT .value
185191 context_token : ContextToken | None = None
186192 span : Span | None = None
187193 input_messages : list [InputMessage ] = field (
You can’t perform that action at this time.
0 commit comments