From d0f227189c073ac67e78ecc41f9c13ffb1f62b21 Mon Sep 17 00:00:00 2001 From: Himanshu Gunwant <69423776+monster-anshu@users.noreply.github.com> Date: Tue, 13 Jan 2026 22:25:52 +0530 Subject: [PATCH] fix: openai llm model name is unknown (#3422) --- changelog/3422.fixed.md | 1 + src/pipecat/utils/tracing/service_decorators.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelog/3422.fixed.md diff --git a/changelog/3422.fixed.md b/changelog/3422.fixed.md new file mode 100644 index 000000000..31b1d93c9 --- /dev/null +++ b/changelog/3422.fixed.md @@ -0,0 +1 @@ +- Fixed a bug in `traced_llm` where the model name in opentelemetry is shown unknown even though it is defined. diff --git a/src/pipecat/utils/tracing/service_decorators.py b/src/pipecat/utils/tracing/service_decorators.py index 22274ae8b..5bcfbd442 100644 --- a/src/pipecat/utils/tracing/service_decorators.py +++ b/src/pipecat/utils/tracing/service_decorators.py @@ -483,9 +483,10 @@ def traced_llm(func: Optional[Callable] = None, *, name: Optional[str] = None) - # Add all available attributes to the span attribute_kwargs = { "service_name": service_class_name, - "model": getattr( - self, getattr(self, "_full_model_name", "model_name"), "unknown" - ), + "model": getattr(self, "_full_model_name", None) + or getattr(self, "model_name", None) + or params.get("model") + or "unknown", "stream": True, # Most LLM services use streaming "parameters": params, }