mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-06-26 22:00:13 +00:00

* added hybrid search example Added an example about hybrid search for faq pipeline on covid dataset * formatted with back formatter * renamed document * fixed * fixed typos * added test added test for hybrid search * fixed withespaces * removed test for hybrid search * fixed pylint * commented logging * updated hybrid search example * release notes * Update hybrid_search_faq_pipeline.py-815df846dca7e872.yaml * Update hybrid_search_faq_pipeline.py * mention hybrid search example in release notes * reduce installed dependencies in examples test workflow * do not install cuda dependencies * skip models if API key not set; delete document indices * skip models if API key not set; delete document indices * skip models if API key not set; delete document indices * keep roberta-base model and inference extra * pylint * disable pylint no-logging-basicconfig rule --------- Co-authored-by: Julian Risch <julian.risch@deepset.ai>
20 lines
1.2 KiB
Python
20 lines
1.2 KiB
Python
from examples.basic_faq_pipeline import basic_faq_pipeline
|
||
|
||
from haystack.schema import Answer
|
||
|
||
|
||
def test_basic_faq_pipeline():
|
||
prediction = basic_faq_pipeline()
|
||
|
||
assert prediction is not None
|
||
assert prediction["query"] == "How is the virus spreading?"
|
||
|
||
assert len(prediction["answers"]) == 10 # top-k of Retriever
|
||
assert type(prediction["answers"][0]) == Answer
|
||
assert (
|
||
prediction["answers"][0].answer
|
||
== """This virus was first detected in Wuhan City, Hubei Province, China. The first infections were linked to a live animal market, but the virus is now spreading from person-to-person. It’s important to note that person-to-person spread can happen on a continuum. Some viruses are highly contagious (like measles), while other viruses are less so.\n\nThe virus that causes COVID-19 seems to be spreading easily and sustainably in the community (“community spread”) in some affected geographic areas. Community spread means people have been infected with the virus in an area, including some who are not sure how or where they became infected.\n\nLearn what is known about the spread of newly emerged coronaviruses."""
|
||
)
|
||
assert prediction["answers"][0].score <= 1
|
||
assert prediction["answers"][0].score >= 0
|