hbertrand commited on
Commit
25a0d11
·
1 Parent(s): 2a13c73
buster/busterbot.py CHANGED
@@ -155,7 +155,7 @@ class Buster:
155
  # Likely that the answer is meaningful, add the top sources
156
  return score < unk_threshold
157
 
158
- def process_input(self, user_input: str) -> str:
159
  """
160
  Main function to process the input question and generate a formatted output.
161
  """
 
155
  # Likely that the answer is meaningful, add the top sources
156
  return score < unk_threshold
157
 
158
+ def process_input(self, user_input: str) -> Response:
159
  """
160
  Main function to process the input question and generate a formatted output.
161
  """
buster/retriever/pickle.py CHANGED
@@ -21,7 +21,7 @@ class PickleRetriever(Retriever):
21
  # Drop the `current` column
22
  documents.drop(columns=["current"], inplace=True)
23
 
24
- if source is not None and "source" in documents.columns:
25
  documents = documents[documents.source == source]
26
 
27
  return documents
 
21
  # Drop the `current` column
22
  documents.drop(columns=["current"], inplace=True)
23
 
24
+ if source not in [None, ""] and "source" in documents.columns:
25
  documents = documents[documents.source == source]
26
 
27
  return documents
tests/test_chatbot.py CHANGED
@@ -157,7 +157,7 @@ def test_chatbot_real_data__chatGPT_OOD():
157
  buster = Buster(cfg=buster_cfg, retriever=retriever)
158
  response = buster.process_input("What is a good recipe for brocolli soup?")
159
  assert isinstance(response.completion.text, str)
160
- assert response.is_relevant is False
161
 
162
 
163
  def test_chatbot_real_data__GPT():
@@ -191,4 +191,4 @@ def test_chatbot_real_data__GPT():
191
  buster = Buster(cfg=hf_transformers_cfg, retriever=retriever)
192
  response = buster.process_input("What is a transformer?")
193
  assert isinstance(response.completion.text, str)
194
- assert response.is_relevant is True
 
157
  buster = Buster(cfg=buster_cfg, retriever=retriever)
158
  response = buster.process_input("What is a good recipe for brocolli soup?")
159
  assert isinstance(response.completion.text, str)
160
+ assert response.is_relevant == False
161
 
162
 
163
  def test_chatbot_real_data__GPT():
 
191
  buster = Buster(cfg=hf_transformers_cfg, retriever=retriever)
192
  response = buster.process_input("What is a transformer?")
193
  assert isinstance(response.completion.text, str)
194
+ assert response.is_relevant == True