BA-Chatbot/backend/retriever/custom_components/join_doc_converter.py

15 lines
714 B
Python
Executable File

from haystack.nodes.base import BaseComponent
from typing import List, Optional
class JoinDocConverter(BaseComponent):
"""Manipulates the output from JoinDocuments so that the DensePassageRetriever can process the results from the join.
See Haystack Custom Nodes for more information about custom nodes: https://haystack.deepset.ai/pipeline_nodes/custom-nodes
"""
outgoing_edges = 1
def run(self, documents):
output = {"documents": documents, "root_node": "Query"}
return output, "output_1"
def run_batch(self,documents, queries: List[str], my_arg: Optional[int] = 10):
output = {"documents": documents, "root_node": "Query"}
return output, "output_1"