@@ -316,23 +316,26 @@ const transformPrompts = (attributes: Record<string, any>): void => {
316316 const messages = promptData . messages ;
317317 const inputMessages : any [ ] = [ ] ;
318318
319- messages . forEach ( ( msg : { role : string ; content : any } , index : number ) => {
320- const processedContent = processMessageContent ( msg . content ) ;
321- const contentKey = `${ SpanAttributes . LLM_PROMPTS } .${ index } .content` ;
322- attributes [ contentKey ] = processedContent ;
323- attributes [ `${ SpanAttributes . LLM_PROMPTS } .${ index } .role` ] = msg . role ;
324-
325- // Add to OpenTelemetry standard gen_ai.input.messages format
326- inputMessages . push ( {
327- role : msg . role ,
328- parts : [
329- {
330- type : TYPE_TEXT ,
331- content : processedContent ,
332- } ,
333- ] ,
334- } ) ;
335- } ) ;
319+ messages . forEach (
320+ ( msg : { role : string ; content : any } , index : number ) => {
321+ const processedContent = processMessageContent ( msg . content ) ;
322+ const contentKey = `${ SpanAttributes . LLM_PROMPTS } .${ index } .content` ;
323+ attributes [ contentKey ] = processedContent ;
324+ attributes [ `${ SpanAttributes . LLM_PROMPTS } .${ index } .role` ] =
325+ msg . role ;
326+
327+ // Add to OpenTelemetry standard gen_ai.input.messages format
328+ inputMessages . push ( {
329+ role : msg . role ,
330+ parts : [
331+ {
332+ type : TYPE_TEXT ,
333+ content : processedContent ,
334+ } ,
335+ ] ,
336+ } ) ;
337+ } ,
338+ ) ;
336339
337340 // Set the OpenTelemetry standard input messages attribute
338341 if ( inputMessages . length > 0 ) {
@@ -527,9 +530,7 @@ const transformFinishReason = (attributes: Record<string, any>): void => {
527530 }
528531} ;
529532
530- const transformToolCallAttributes = (
531- attributes : Record < string , any > ,
532- ) : void => {
533+ const transformToolCallAttributes = ( attributes : Record < string , any > ) : void => {
533534 // Transform tool name
534535 if ( "ai.toolCall.name" in attributes ) {
535536 attributes [ SpanAttributes . GEN_AI_TOOL_NAME ] =
@@ -704,6 +705,7 @@ const transformToolCalls = (span: ReadableSpan): void => {
704705 const toolName = span . attributes [ "ai.toolCall.name" ] ;
705706 if ( toolName ) {
706707 span . attributes [ SpanAttributes . TRACELOOP_ENTITY_NAME ] = toolName ;
708+ delete span . attributes [ "ai.toolCall.name" ] ;
707709 }
708710 }
709711} ;
0 commit comments