Skip to content

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

chore: update pipcat otel attribute mapping (#6944)

Marc Klingen1571de133bc4
diff --git a/web/src/features/otel/server/index.ts b/web/src/features/otel/server/index.ts
index 6b7d5a3d15..8e47ddd926 100644
--- a/web/src/features/otel/server/index.ts
+++ b/web/src/features/otel/server/index.ts
@@ -242,7 +242,7 @@ const extractInputAndOutput = (
return { input, output };
}
- // Pydantic uses input and output
+ // Pydantic and Pipecat uses input and output
input = attributes["input"];
output = attributes["output"];
if (input || output) {
@@ -271,12 +271,6 @@ const extractInputAndOutput = (
};
}
- // Pipecat uses messages attribute
- input = attributes["messages"];
- if (input) {
- return { input, output: null };
- }
-
return { input: null, output: null };
};
@@ -475,11 +469,7 @@ const extractUsageDetails = (
const usageDetails = Object.keys(attributes).filter(
(key) =>
(key.startsWith("gen_ai.usage.") && key !== "gen_ai.usage.cost") ||
- key.startsWith("llm.token_count") ||
- // pipecat logs usage metrics using llm.* attributes
- key === "llm.prompt_tokens" ||
- key === "llm.completion_tokens" ||
- key === "llm.total_tokens",
+ key.startsWith("llm.token_count"),
);
const usageDetailKeyMapping: Record<string, string> = {
@@ -495,8 +485,7 @@ const extractUsageDetails = (
return usageDetails.reduce((acc: any, key) => {
const usageDetailKey = key
.replace("gen_ai.usage.", "")
- .replace("llm.token_count.", "")
- .replace("llm.", "");
+ .replace("llm.token_count.", "");
const mappedUsageDetailKey =
usageDetailKeyMapping[usageDetailKey] ?? usageDetailKey;
// Cast the respective key to a number