🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(otel): map gen_ai.tool.call.arguments/result to input/output (#9430)
Grégoire69c730f1a0e5
diff --git a/packages/shared/src/server/otel/OtelIngestionProcessor.ts b/packages/shared/src/server/otel/OtelIngestionProcessor.tsindex 528b12cf7f..9a96aa8cbc 100644--- a/packages/shared/src/server/otel/OtelIngestionProcessor.ts+++ b/packages/shared/src/server/otel/OtelIngestionProcessor.ts@@ -1311,13 +1311,20 @@ export class OtelIngestionProcessor {};}- // OpenTelemetry (https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans)+ // OpenTelemetry messages (https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans)input = attributes["gen_ai.input.messages"];output = attributes["gen_ai.output.messages"];if (input || output) {return { input, output };}+ // OpenTelemetry tools (https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans)+ input = attributes["gen_ai.tool.call.arguments"];+ output = attributes["gen_ai.tool.call.result"];+ if (input || output) {+ return { input, output };+ }+return { input: null, output: null };}diff --git a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts b/web/src/__tests__/server/api/otel/otelMapping.servertest.tsindex 70349c473f..9020e41099 100644--- a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts+++ b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts@@ -2105,6 +2105,30 @@ describe("OTel Resource Span Mapping", () => {entityAttributeValue: '{"foo": "bar"}',},],+ [+ "should map gen_ai.tool.call.arguments to input",+ {+ entity: "observation",+ otelAttributeKey: "gen_ai.tool.call.arguments",+ otelAttributeValue: {+ stringValue: '{"foo": "bar"}',+ },+ entityAttributeKey: "input",+ entityAttributeValue: '{"foo": "bar"}',+ },+ ],+ [+ "should map gen_ai.tool.call.result to output",+ {+ entity: "observation",+ otelAttributeKey: "gen_ai.tool.call.result",+ otelAttributeValue: {+ stringValue: '{"foo": "bar"}',+ },+ entityAttributeKey: "output",+ entityAttributeValue: '{"foo": "bar"}',+ },+ ],["should map gcp.vertex.agent.tool_call_args to input",{