Skip to content

Commit d0f2271

Browse files
fix: openai llm model name is unknown (pipecat-ai#3422)
1 parent ae59b3b commit d0f2271

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

changelog/3422.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed a bug in `traced_llm` where the model name in opentelemetry is shown unknown even though it is defined.

src/pipecat/utils/tracing/service_decorators.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,10 @@ async def wrapped_start_llm_usage_metrics(tokens):
483483
# Add all available attributes to the span
484484
attribute_kwargs = {
485485
"service_name": service_class_name,
486-
"model": getattr(
487-
self, getattr(self, "_full_model_name", "model_name"), "unknown"
488-
),
486+
"model": getattr(self, "_full_model_name", None)
487+
or getattr(self, "model_name", None)
488+
or params.get("model")
489+
or "unknown",
489490
"stream": True, # Most LLM services use streaming
490491
"parameters": params,
491492
}

0 commit comments

Comments
 (0)