Marqo + Haystack 2.0 Integration

Marqo can now be used as a document store for Haystack 2.0! You can get started by installing the marqo-haystack package.

pip install marqo-haystack

To use the Marqo document store in haystack simply import it:

from marqo_haystack import MarqoDocumentStore
document_store = MarqoDocumentStore()

You can then use it in your Haystack pipelines like so:


from haystack.preview.components.file_converters import TextFileToDocument
from haystack.preview.components.writers import DocumentWriter

indexing = Pipeline()
indexing.add_component("converter", TextFileToDocument())
indexing.add_component("writer", DocumentWriter(document_store))
indexing.connect("converter", "writer"){"converter": {"paths": file_paths}})


from marqo_haystack.retriever import MarqoSingleRetriever

querying = Pipeline()
querying.add_component("retriever", MarqoSingleRetriever(document_store))
results ={"retriever": {"query": "Who is Marco Polo?", "top_k": 3}})

For more details check out there official integration page from deepset.