wop commited on
Commit
91c3eb6
·
verified ·
1 Parent(s): 7f1d3a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -63,11 +63,12 @@ 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
- 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)
 
 
 
71
  messages.append(
72
  {
73
  "tool_call_id": tool_call.id,
 
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
+ if function_name not in available_functions:
69
+ function_response = "invalid tool"
70
+ else:
71
+ function_response = function_to_call(**function_args)
72
  messages.append(
73
  {
74
  "tool_call_id": tool_call.id,