@@ -260,6 +260,7 @@ class GenAIInvocation:
260260 span : Span | None = None
261261 attributes : dict [str , Any ] = field (default_factory = _new_str_any_dict )
262262 error_type : str | None = None
263+ operation_name : str = ""
263264
264265 monotonic_start_s : float | None = None
265266 """
@@ -277,7 +278,6 @@ class WorkflowInvocation(GenAIInvocation):
277278 """
278279
279280 name : str = ""
280- operation_name : str = "invoke_workflow"
281281 input_messages : list [InputMessage ] = field (
282282 default_factory = _new_input_messages
283283 )
@@ -297,7 +297,6 @@ class LLMInvocation(GenAIInvocation):
297297 set by the TelemetryHandler.
298298 """
299299
300- operation_name : str = GenAI .GenAiOperationNameValues .CHAT .value
301300 request_model : str | None = None
302301 input_messages : list [InputMessage ] = field (
303302 default_factory = _new_input_messages
@@ -336,6 +335,9 @@ class LLMInvocation(GenAIInvocation):
336335 server_address : str | None = None
337336 server_port : int | None = None
338337
338+ def __post_init__ (self ) -> None :
339+ self .operation_name = GenAI .GenAiOperationNameValues .CHAT .value
340+
339341
340342@dataclass
341343class EmbeddingInvocation (GenAIInvocation ):
@@ -345,7 +347,6 @@ class EmbeddingInvocation(GenAIInvocation):
345347 and context_token attributes are set by the TelemetryHandler.
346348 """
347349
348- operation_name : str = GenAI .GenAiOperationNameValues .EMBEDDINGS .value
349350 request_model : str | None = None
350351 provider : str | None = None # e.g., azure.ai.openai, openai, aws.bedrock
351352 server_address : str | None = None
@@ -372,6 +373,9 @@ class EmbeddingInvocation(GenAIInvocation):
372373 These attributes will not be set on spans or events.
373374 """
374375
376+ def __post_init__ (self ) -> None :
377+ self .operation_name = GenAI .GenAiOperationNameValues .EMBEDDINGS .value
378+
375379
376380@dataclass ()
377381class ToolCall (GenAIInvocation ):
@@ -428,6 +432,9 @@ class ToolCall(GenAIInvocation):
428432 # Timing field (not inherited from GenAIInvocation, matches LLMInvocation pattern)
429433 monotonic_start_s : float | None = None
430434
435+ def __post_init__ (self ) -> None :
436+ self .operation_name = GenAI .GenAiOperationNameValues .EXECUTE_TOOL .value
437+
431438
432439@dataclass
433440class Error :
0 commit comments