🪢 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
Map gen_ai.input/output.messages to input/output (#8813)
Grégoire14fbeb178869
diff --git a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts b/web/src/__tests__/server/api/otel/otelMapping.servertest.tsindex 486294467b..6155705826 100644--- a/web/src/__tests__/server/api/otel/otelMapping.servertest.ts+++ b/web/src/__tests__/server/api/otel/otelMapping.servertest.ts@@ -1993,6 +1993,30 @@ describe("OTel Resource Span Mapping", () => {entityAttributeValue: ["2", "3", "4"],},],+ [+ "should map gen_ai.input.messages to input",+ {+ entity: "observation",+ otelAttributeKey: "gen_ai.input.messages",+ otelAttributeValue: {+ stringValue: '{"foo": "bar"}',+ },+ entityAttributeKey: "input",+ entityAttributeValue: '{"foo": "bar"}',+ },+ ],+ [+ "should map gen_ai.output.messages to output",+ {+ entity: "observation",+ otelAttributeKey: "gen_ai.output.messages",+ otelAttributeValue: {+ stringValue: '{"foo": "bar"}',+ },+ entityAttributeKey: "output",+ entityAttributeValue: '{"foo": "bar"}',+ },+ ],])("Attributes: %s",async (diff --git a/web/src/features/otel/server/OtelIngestionProcessor.ts b/web/src/features/otel/server/OtelIngestionProcessor.tsindex ae47d9511c..a545ebac86 100644--- a/web/src/features/otel/server/OtelIngestionProcessor.ts+++ b/web/src/features/otel/server/OtelIngestionProcessor.ts@@ -1076,6 +1076,13 @@ export class OtelIngestionProcessor {};}+ // OpenTelemetry (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 };+ }+return { input: null, output: null };}