💡 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
Refactor embeddings method
davidmezzetti0615976b6be8
diff --git a/src/python/txtai/embeddings/base.py b/src/python/txtai/embeddings/base.pyindex ba485557..9768c7f5 100644--- a/src/python/txtai/embeddings/base.py+++ b/src/python/txtai/embeddings/base.py@@ -283,7 +283,7 @@ class Embeddings:list of (id, score) for ann search, list of dict for an ann+database search"""- results = self.batchsearch([query], limit if limit else 3)+ results = self.batchsearch([query], limit)return results[0] if results else resultsdef batchsearch(self, queries, limit=None):@@ -353,7 +353,8 @@ class Embeddings:list of dict per input text where a higher token scores represents higher importance relative to the query"""- return Explain(self)([query], texts, limit)[0]+ results = self.batchexplain([query], texts, limit)+ return results[0] if results else resultsdef batchexplain(self, queries, texts=None, limit=None):"""