Omnibus commited on
Commit
f73f9aa
·
1 Parent(s): ff4e925

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -47,27 +47,27 @@ def format_prompt(message, history):
47
  def call_search(purpose, task, history, action_input):
48
  return_list=[]
49
  print (action_input)
50
- if action_input in query.tasks:
51
- print (trying)
52
- try:
53
- if action_input != "" and action_input != None:
54
- action_input.strip('""')
55
- model_list = api.list_models(task=f"{action_input}")
56
- this_obj = list(model_list)
57
- print(f'THIS_OBJ :: {this_obj[0]}')
58
- for i,eb in enumerate(this_obj):
59
- #return_list.append(this_obj[i].id)
60
- return_list.append(this_obj[i])
61
- #json_obj=json.dumps(return_list, indent=4)
62
- print (return_list)
63
- history = "observation: the search results are:\n {}\n".format(return_list)
64
- else:
65
- history = "observation: I need to trigger a search using the following syntax:\naction: SEARCH action_input SEARCH_QUERY"
66
- except Exception as e:
67
- print (e)
68
- history = "observation: The search query I used did not return a valid response, I should try a different query"
69
- else:
70
- history = "observation: The search query I used did not return a valid response, I should use a query from the list of tasks provide in the format 'text-generation'"
71
 
72
  return "MAIN", None, history, task
73
 
 
47
  def call_search(purpose, task, history, action_input):
48
  return_list=[]
49
  print (action_input)
50
+ #if action_input in query.tasks:
51
+ print (trying)
52
+ try:
53
+ if action_input != "" and action_input != None:
54
+ action_input.strip('""')
55
+ model_list = api.list_models(task=f"{action_input}")
56
+ this_obj = list(model_list)
57
+ print(f'THIS_OBJ :: {this_obj[0]}')
58
+ for i,eb in enumerate(this_obj):
59
+ #return_list.append(this_obj[i].id)
60
+ return_list.append(this_obj[i])
61
+ #json_obj=json.dumps(return_list, indent=4)
62
+ print (return_list)
63
+ history = "observation: the search results are:\n {}\n".format(return_list)
64
+ else:
65
+ history = "observation: I need to trigger a search using the following syntax:\naction: SEARCH action_input SEARCH_QUERY"
66
+ except Exception as e:
67
+ print (e)
68
+ history = "observation: The search query I used did not return a valid response, I should try a different query from the list of options"
69
+ #else:
70
+ # history = "observation: The search query I used did not return a valid response"
71
 
72
  return "MAIN", None, history, task
73