Add scaffold for defining custom components for Pipelines (#1205)

This commit is contained in:
oryx1729 2021-06-23 12:01:54 +02:00 committed by GitHub
parent 02fc4c7783
commit afee4f36ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import os
PIPELINE_YAML_PATH = os.getenv("PIPELINE_YAML_PATH", "rest_api/pipelines.yaml")
PIPELINE_YAML_PATH = os.getenv("PIPELINE_YAML_PATH", "rest_api/pipeline/pipelines.yaml")
QUERY_PIPELINE_NAME = os.getenv("QUERY_PIPELINE_NAME", "query")
INDEXING_PIPELINE_NAME = os.getenv("INDEXING_PIPELINE_NAME", "indexing")

View File

@ -0,0 +1 @@
from rest_api.pipeline import custom_component # this import is required for the Custom Components to be registered

View File

@ -0,0 +1,17 @@
"""
Pipelines allow putting together Components to build a graph.
In addition to the standard Haystack Components, custom user-defined Components
can be used in a Pipeline YAML configuration.
The classes for the Custom Components must be defined in this file.
"""
from haystack import BaseComponent
class SampleComponent(BaseComponent):
def run(self, **kwargs):
raise NotImplementedError