mirror of
				https://github.com/deepset-ai/haystack.git
				synced 2025-11-02 18:59:28 +00:00 
			
		
		
		
	Add scaffold for defining custom components for Pipelines (#1205)
This commit is contained in:
		
							parent
							
								
									02fc4c7783
								
							
						
					
					
						commit
						afee4f36ce
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
import os
 | 
					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")
 | 
					QUERY_PIPELINE_NAME = os.getenv("QUERY_PIPELINE_NAME", "query")
 | 
				
			||||||
INDEXING_PIPELINE_NAME = os.getenv("INDEXING_PIPELINE_NAME", "indexing")
 | 
					INDEXING_PIPELINE_NAME = os.getenv("INDEXING_PIPELINE_NAME", "indexing")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					from rest_api.pipeline import custom_component  # this import is required for the Custom Components to be registered
 | 
				
			||||||
							
								
								
									
										17
									
								
								rest_api/pipeline/custom_component.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								rest_api/pipeline/custom_component.py
									
									
									
									
									
										Normal 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
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user