💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Add ability for extractor to reference another pipeline in applications, closes #501
davidmezzetti97401266228c
diff --git a/src/python/txtai/app/base.py b/src/python/txtai/app/base.pyindex 437f09c7..dfe4be63 100644--- a/src/python/txtai/app/base.py+++ b/src/python/txtai/app/base.py@@ -102,6 +102,9 @@ class Application:if "." in key:pipelines.append(key)+ # Move dependent pipelines to end of list+ pipelines = sorted(pipelines, key=lambda x: x in ["similarity", "extractor"])+# Create pipelinesfor pipeline in pipelines:if pipeline in self.config:@@ -115,6 +118,11 @@ class Application:if pipeline == "extractor" and "similarity" not in config:# Add placeholder, will be set to embeddings index once initializedconfig["similarity"] = None++ # Resolve reference pipeline, if necessary+ if config.get("path") in self.pipelines:+ config["path"] = self.pipelines[config["path"]]+elif pipeline == "similarity" and "path" not in config and "labels" in self.pipelines:config["model"] = self.pipelines["labels"]diff --git a/test/python/testapi/testembeddings.py b/test/python/testapi/testembeddings.pyindex 65665515..90e31491 100644--- a/test/python/testapi/testembeddings.py+++ b/test/python/testapi/testembeddings.py@@ -21,13 +21,17 @@ path: %s# Allow indexing of documentswritable: True+# Questions settings+questions:+ path: distilbert-base-cased-distilled-squad+# Embeddings settingsembeddings:path: sentence-transformers/nli-mpnet-base-v2# Extractor settingsextractor:- path: distilbert-base-cased-distilled-squad+ path: questions"""# Configuration for a read-only embeddings index