Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(otel-ai-sdk): handle tool calls with empty string in ai.response.text (#10505)

Hassieb Pakzadd596cd109aa8
diff --git a/packages/shared/src/server/otel/OtelIngestionProcessor.ts b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
index 5ed442c9d8..5d4750acba 100644
--- a/packages/shared/src/server/otel/OtelIngestionProcessor.ts
+++ b/packages/shared/src/server/otel/OtelIngestionProcessor.ts
@@ -1211,7 +1211,8 @@ export class OtelIngestionProcessor {
: undefined;
output =
- "ai.response.text" in attributes
+ "ai.response.text" in attributes &&
+ Boolean(attributes["ai.response.text"])
? attributes["ai.response.text"]
: "ai.result.text" in attributes // Legacy support for ai SDK versions < 4.0.0
? attributes["ai.result.text"]