HomeGuidesAPI ReferenceTutorials
Haystack

Doc2Answers

Use this Node to convert retrieved Documents into Answers. It allows you to call a Retriever-only pipeline using REST API.

Position in a PipelineAt the end of a querying Pipeline
InputDocuments
OutputAnswers
ClassesDocs2Answers

Usage

To use it in a Pipeline:

from haystack.nodes import Pipeline
from haystack.nodes import Docs2Answers

docs2answers = Docs2Answers()

pipe = Pipeline()
pipe.add_node(component=retriever, name="Retriever", inputs=["Query"])
pipe.add_node(component=docs2answers, name="Doc2Answers", inputs=["Retriever"])
res = pipe.run(query="What did Einstein work on?")

Related Links