cafierom commited on
Commit
e68f539
·
verified ·
1 Parent(s): 99fa6ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -320,20 +320,27 @@ does not inform about features unique to each molecule.'
320
 
321
  tool_choices = str(res).split('<|assistant|>')[1].split('#')[0].strip()
322
  tool_choices = tool_choices.split(',')
 
323
  if len(tool_choices) == 1:
324
- if tool_choices[0].strip().lower() == 'none':
 
325
  tool_choice = (None, None)
326
  else:
327
- tool_choice = (tool_choices[0].strip().lower(), None)
328
  elif len(tool_choices) == 2:
329
- if tool_choices[0].strip().lower() == 'none':
330
- tool_choice = (None, tool_choices[1].strip().lower())
331
- elif tool_choices[1].strip().lower() == 'none':
332
- tool_choice = (tool_choices[0].strip().lower(), None)
 
 
 
 
333
  else:
334
- tool_choice = (tool_choices[0].strip().lower(), tool_choices[1].strip().lower())
335
  else:
336
  tool_choice = (None, None)
 
337
  state["tool_choice"] = tool_choice
338
  state["which_tool"] = 0
339
  print(f"The chosen tools are: {tool_choice}")
 
320
 
321
  tool_choices = str(res).split('<|assistant|>')[1].split('#')[0].strip()
322
  tool_choices = tool_choices.split(',')
323
+
324
  if len(tool_choices) == 1:
325
+ tool1 = tool_choices[0].strip()
326
+ if tool1.lower() == 'none':
327
  tool_choice = (None, None)
328
  else:
329
+ tool_choice = (tool1, None)
330
  elif len(tool_choices) == 2:
331
+ tool1 = tool_choices[0].lower().strip()
332
+ tool2 = tool_choices[1].lower().strip()
333
+ if tool1.lower() == 'none' and tool2.lower() == 'none':
334
+ tool_choice = (None, None)
335
+ elif tool1.lower() == 'none' and tool2.lower() != 'none':
336
+ tool_choice = (None, tool2)
337
+ elif tool2.lower() == 'none' and tool1.lower() != 'none':
338
+ tool_choice = (tool1, None)
339
  else:
340
+ tool_choice = (tool1, tool2)
341
  else:
342
  tool_choice = (None, None)
343
+
344
  state["tool_choice"] = tool_choice
345
  state["which_tool"] = 0
346
  print(f"The chosen tools are: {tool_choice}")