Spaces:
Runtime error
Runtime error
tests
Browse files- buster/busterbot.py +1 -1
- buster/retriever/pickle.py +1 -1
- tests/test_chatbot.py +2 -2
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) ->
|
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
|
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
|
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
|
|
|
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
|