mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
updates
This commit is contained in:
parent
cace0bd6fb
commit
872ff6176d
2 changed files with 7 additions and 4 deletions
|
|
@ -604,13 +604,13 @@ def convert_to_anthropic_tool_result(message: dict) -> str:
|
|||
def convert_to_anthropic_tool_invoke(tool_calls: list) -> str:
|
||||
invokes = ""
|
||||
for tool in tool_calls:
|
||||
if tool["type"] != "function":
|
||||
if tool.type != "function":
|
||||
continue
|
||||
|
||||
tool_name = tool["function"]["name"]
|
||||
tool_name = tool.function.name
|
||||
parameters = "".join(
|
||||
f"<{param}>{val}</{param}>\n"
|
||||
for param, val in json.loads(tool["function"]["arguments"]).items()
|
||||
for param, val in json.loads(tool.function.arguments).items()
|
||||
)
|
||||
invokes += (
|
||||
"<invoke>\n"
|
||||
|
|
|
|||
|
|
@ -271,7 +271,10 @@ class Message(OpenAIObject):
|
|||
if tool_calls is not None:
|
||||
self.tool_calls = []
|
||||
for tool_call in tool_calls:
|
||||
self.tool_calls.append(ChatCompletionMessageToolCall(**tool_call))
|
||||
if isinstance(tool_call, dict):
|
||||
self.tool_calls.append(ChatCompletionMessageToolCall(**tool_call))
|
||||
else:
|
||||
self.tool_calls.append(tool_call)
|
||||
|
||||
if logprobs is not None:
|
||||
self._logprobs = logprobs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue