File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
packages/traceloop-sdk/src/lib/tracing Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -492,6 +492,27 @@ const transformTelemetryMetadata = (
492492 attributes [ SpanAttributes . TRACELOOP_SPAN_KIND ] =
493493 TraceloopSpanKindValues . AGENT ;
494494 attributes [ SpanAttributes . TRACELOOP_ENTITY_NAME ] = agentName ;
495+
496+ const inputMessages = attributes [ SpanAttributes . LLM_INPUT_MESSAGES ] ;
497+ const outputMessages = attributes [ SpanAttributes . LLM_OUTPUT_MESSAGES ] ;
498+ const toolArgs = attributes [ "ai.toolCall.args" ] ;
499+ const toolResult = attributes [ "ai.toolCall.result" ] ;
500+
501+ if ( inputMessages || outputMessages ) {
502+ if ( inputMessages ) {
503+ attributes [ SpanAttributes . TRACELOOP_ENTITY_INPUT ] = inputMessages ;
504+ }
505+ if ( outputMessages ) {
506+ attributes [ SpanAttributes . TRACELOOP_ENTITY_OUTPUT ] = outputMessages ;
507+ }
508+ } else if ( toolArgs || toolResult ) {
509+ if ( toolArgs ) {
510+ attributes [ SpanAttributes . TRACELOOP_ENTITY_INPUT ] = toolArgs ;
511+ }
512+ if ( toolResult ) {
513+ attributes [ SpanAttributes . TRACELOOP_ENTITY_OUTPUT ] = toolResult ;
514+ }
515+ }
495516 }
496517 }
497518
You can’t perform that action at this time.
0 commit comments