Du Mingzhe commited on
Commit
cf57fc5
1 Parent(s): bef4d2c
Files changed (2) hide show
  1. app.py +1 -1
  2. components.py +1 -1
app.py CHANGED
@@ -32,7 +32,7 @@ if prompt := st.chat_input("What's up?"):
32
  web_query = llm_client.web_query_generator(query=prompt, history=st.session_state.messages)
33
  print(f"Web Query: {web_query}")
34
 
35
- web_result = web_searcher.query_bing(query=prompt) if web_query != 'None' else "None"
36
  # web_result = web_searcher.query_web_llm(query=prompt, num_web_results=10) if web_query != 'None' else "None"
37
  print(f"Web Result: {web_result}")
38
 
 
32
  web_query = llm_client.web_query_generator(query=prompt, history=st.session_state.messages)
33
  print(f"Web Query: {web_query}")
34
 
35
+ web_result = web_searcher.query_bing(query=web_query) if web_query != 'None' else "None"
36
  # web_result = web_searcher.query_web_llm(query=prompt, num_web_results=10) if web_query != 'None' else "None"
37
  print(f"Web Result: {web_result}")
38
 
components.py CHANGED
@@ -25,7 +25,7 @@ class LLMClient():
25
  messages += [{"role": h["role"], "content": h["content"]} for h in history[:-1]]
26
 
27
  # messages += [{"role": 'user', "content": f"Given the context, generate a proper web search query. If you know the answer already, return 'None' directly."}]
28
- messages += [{"role": 'user', "content": f"Given the context, generate a proper web search query."}]
29
 
30
  response = self.llm_client.chat.completions.create(
31
  model = self.model_name,
 
25
  messages += [{"role": h["role"], "content": h["content"]} for h in history[:-1]]
26
 
27
  # messages += [{"role": 'user', "content": f"Given the context, generate a proper web search query. If you know the answer already, return 'None' directly."}]
28
+ messages += [{"role": 'user', "content": f"Given the context, generate a proper web search query. Return 'None' if you can't generate a query based on the current context."}]
29
 
30
  response = self.llm_client.chat.completions.create(
31
  model = self.model_name,