fix: openai llm model name is unknown (#3422)
This commit is contained in:
1
changelog/3422.fixed.md
Normal file
1
changelog/3422.fixed.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Fixed a bug in `traced_llm` where the model name in opentelemetry is shown unknown even though it is defined.
|
||||||
@@ -483,9 +483,10 @@ def traced_llm(func: Optional[Callable] = None, *, name: Optional[str] = None) -
|
|||||||
# Add all available attributes to the span
|
# Add all available attributes to the span
|
||||||
attribute_kwargs = {
|
attribute_kwargs = {
|
||||||
"service_name": service_class_name,
|
"service_name": service_class_name,
|
||||||
"model": getattr(
|
"model": getattr(self, "_full_model_name", None)
|
||||||
self, getattr(self, "_full_model_name", "model_name"), "unknown"
|
or getattr(self, "model_name", None)
|
||||||
),
|
or params.get("model")
|
||||||
|
or "unknown",
|
||||||
"stream": True, # Most LLM services use streaming
|
"stream": True, # Most LLM services use streaming
|
||||||
"parameters": params,
|
"parameters": params,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user