Haystack
HaystackRetriever
¶
Bases: LocalStep
Class for document retrieval using Haystack v2 pipelines.
Source code in ragfit/processing/local_steps/retrievers/haystack.py
default_query_function(query)
¶
Create the default querying of the pipeline, by inserting the input query into all mandatory fields.
Source code in ragfit/processing/local_steps/retrievers/haystack.py
process_item(item, index, datasets, **kwargs)
¶
Query the query_key
in the item and store the results in the docs_key
.
Retrieved documents are stored as a list of dictionaries with keys content
and title
.
Source code in ragfit/processing/local_steps/retrievers/haystack.py
query(query, structure=None)
¶
Haystack v2 pipelines can have multiple inputs; structure specify how to call pipe.run
.
For example, structure could look like this: { "Retriever": {"query": "query",}, "Reranker": {"query": "query"}, } and we replace the value of each key with the query.