Skip to content

Commit

Permalink
fix if-else condition when function_call exits but empty
Browse files Browse the repository at this point in the history
  • Loading branch information
kan-bayashi committed Feb 14, 2024
1 parent 917525e commit 9077591
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions litellm/llms/vertex_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,13 @@ def completion(
tools=tools,
)

if tools is not None and hasattr(
response.candidates[0].content.parts[0], "function_call"
if tools is not None and bool(
getattr(response.candidates[0].content.parts[0], "function_call", None)
):
function_call = response.candidates[0].content.parts[0].function_call
args_dict = {}
if function_call.args is not None:
for k, v in function_call.args.items():
args_dict[k] = v
for k, v in function_call.args.items():
args_dict[k] = v
args_str = json.dumps(args_dict)
message = litellm.Message(
content=None,
Expand Down

0 comments on commit 9077591

Please sign in to comment.