wop commited on
Commit
7f1d3a6
·
verified ·
1 Parent(s): 71f38ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -63,6 +63,8 @@ def run_conversation(user_prompt, messages, model_option, max_tokens):
63
 
64
  for tool_call in tool_calls:
65
  function_name = tool_call.function.name
 
 
66
  function_to_call = available_functions[function_name]
67
  function_args = json.loads(tool_call.function.arguments)
68
  function_response = function_to_call(**function_args)
 
63
 
64
  for tool_call in tool_calls:
65
  function_name = tool_call.function.name
66
+ if function_name not in available_functions:
67
+ return "Invalid tool provided."
68
  function_to_call = available_functions[function_name]
69
  function_args = json.loads(tool_call.function.arguments)
70
  function_response = function_to_call(**function_args)