Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -695,12 +695,13 @@ should be called before this tool.
|
|
| 695 |
'''
|
| 696 |
res = chat_model.invoke(prompt)
|
| 697 |
|
|
|
|
| 698 |
tool_choices = str(res).split('<|assistant|>')[1].split('#')[0].strip()
|
| 699 |
tool_choices = tool_choices.split(',')
|
| 700 |
|
| 701 |
if len(tool_choices) == 1:
|
| 702 |
tool1 = tool_choices[0].strip()
|
| 703 |
-
if ('get_bioactives' in tool1) and (state['query_chembl']
|
| 704 |
tool1 = 'list_bioactives_tool'
|
| 705 |
if tool1.lower() == 'none':
|
| 706 |
tool_choice = (None, None)
|
|
@@ -709,9 +710,9 @@ should be called before this tool.
|
|
| 709 |
elif len(tool_choices) == 2:
|
| 710 |
tool1 = tool_choices[0].strip()
|
| 711 |
tool2 = tool_choices[1].strip()
|
| 712 |
-
if ('get_bioactives' in tool1) and (state['query_chembl']
|
| 713 |
tool1 = 'list_bioactives_tool'
|
| 714 |
-
if ('get_bioactives' in tool2) and (state['query_chembl']
|
| 715 |
tool2 = 'list_bioactives_tool'
|
| 716 |
if tool1.lower() == 'none' and tool2.lower() == 'none':
|
| 717 |
tool_choice = (None, None)
|
|
@@ -798,7 +799,7 @@ should be called before this tool.
|
|
| 798 |
|
| 799 |
if len(tool_choices) == 1:
|
| 800 |
tool1 = tool_choices[0].strip()
|
| 801 |
-
if ('get_bioactives' in tool1) and (state['query_chembl']
|
| 802 |
tool1 = 'list_bioactives_tool'
|
| 803 |
if tool1.lower() == 'none':
|
| 804 |
tool_choice = (None, None)
|
|
@@ -807,9 +808,9 @@ should be called before this tool.
|
|
| 807 |
elif len(tool_choices) == 2:
|
| 808 |
tool1 = tool_choices[0].strip()
|
| 809 |
tool2 = tool_choices[1].strip()
|
| 810 |
-
if ('get_bioactives' in tool1) and (state['query_chembl']
|
| 811 |
tool1 = 'list_bioactives_tool'
|
| 812 |
-
if ('get_bioactives' in tool2) and (state['query_chembl']
|
| 813 |
tool2 = 'list_bioactives_tool'
|
| 814 |
if tool1.lower() == 'none' and tool2.lower() == 'none':
|
| 815 |
tool_choice = (None, None)
|
|
|
|
| 695 |
'''
|
| 696 |
res = chat_model.invoke(prompt)
|
| 697 |
|
| 698 |
+
none_list = [None, '', 'None', 'none']
|
| 699 |
tool_choices = str(res).split('<|assistant|>')[1].split('#')[0].strip()
|
| 700 |
tool_choices = tool_choices.split(',')
|
| 701 |
|
| 702 |
if len(tool_choices) == 1:
|
| 703 |
tool1 = tool_choices[0].strip()
|
| 704 |
+
if ('get_bioactives' in tool1) and (state['query_chembl'] in none_list):
|
| 705 |
tool1 = 'list_bioactives_tool'
|
| 706 |
if tool1.lower() == 'none':
|
| 707 |
tool_choice = (None, None)
|
|
|
|
| 710 |
elif len(tool_choices) == 2:
|
| 711 |
tool1 = tool_choices[0].strip()
|
| 712 |
tool2 = tool_choices[1].strip()
|
| 713 |
+
if ('get_bioactives' in tool1) and (state['query_chembl'] in none_list):
|
| 714 |
tool1 = 'list_bioactives_tool'
|
| 715 |
+
if ('get_bioactives' in tool2) and (state['query_chembl'] in none_list):
|
| 716 |
tool2 = 'list_bioactives_tool'
|
| 717 |
if tool1.lower() == 'none' and tool2.lower() == 'none':
|
| 718 |
tool_choice = (None, None)
|
|
|
|
| 799 |
|
| 800 |
if len(tool_choices) == 1:
|
| 801 |
tool1 = tool_choices[0].strip()
|
| 802 |
+
if ('get_bioactives' in tool1) and (state['query_chembl'] in none_list):
|
| 803 |
tool1 = 'list_bioactives_tool'
|
| 804 |
if tool1.lower() == 'none':
|
| 805 |
tool_choice = (None, None)
|
|
|
|
| 808 |
elif len(tool_choices) == 2:
|
| 809 |
tool1 = tool_choices[0].strip()
|
| 810 |
tool2 = tool_choices[1].strip()
|
| 811 |
+
if ('get_bioactives' in tool1) and (state['query_chembl'] in none_list):
|
| 812 |
tool1 = 'list_bioactives_tool'
|
| 813 |
+
if ('get_bioactives' in tool2) and (state['query_chembl'] in none_list):
|
| 814 |
tool2 = 'list_bioactives_tool'
|
| 815 |
if tool1.lower() == 'none' and tool2.lower() == 'none':
|
| 816 |
tool_choice = (None, None)
|