mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix if-else condition when function_call exits but empty
This commit is contained in:
parent
917525ee43
commit
90775910e2
1 changed files with 4 additions and 5 deletions
|
@ -432,14 +432,13 @@ def completion(
|
||||||
tools=tools,
|
tools=tools,
|
||||||
)
|
)
|
||||||
|
|
||||||
if tools is not None and hasattr(
|
if tools is not None and bool(
|
||||||
response.candidates[0].content.parts[0], "function_call"
|
getattr(response.candidates[0].content.parts[0], "function_call", None)
|
||||||
):
|
):
|
||||||
function_call = response.candidates[0].content.parts[0].function_call
|
function_call = response.candidates[0].content.parts[0].function_call
|
||||||
args_dict = {}
|
args_dict = {}
|
||||||
if function_call.args is not None:
|
for k, v in function_call.args.items():
|
||||||
for k, v in function_call.args.items():
|
args_dict[k] = v
|
||||||
args_dict[k] = v
|
|
||||||
args_str = json.dumps(args_dict)
|
args_str = json.dumps(args_dict)
|
||||||
message = litellm.Message(
|
message = litellm.Message(
|
||||||
content=None,
|
content=None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue