forked from phoenix/litellm-mirror
fix(utils.py): fix trim_messages to handle tool calling
Fixes https://github.com/BerriAI/litellm/issues/4931
This commit is contained in:
parent
dd2d61bfce
commit
ae4bcd8a41
4 changed files with 100 additions and 11 deletions
|
@ -312,7 +312,14 @@ class Message(OpenAIObject):
|
|||
FunctionCall(**function_call) if function_call is not None else None
|
||||
),
|
||||
"tool_calls": (
|
||||
[ChatCompletionMessageToolCall(**tool_call) for tool_call in tool_calls]
|
||||
[
|
||||
(
|
||||
ChatCompletionMessageToolCall(**tool_call)
|
||||
if isinstance(tool_call, dict)
|
||||
else tool_call
|
||||
)
|
||||
for tool_call in tool_calls
|
||||
]
|
||||
if tool_calls is not None
|
||||
else None
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue