Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Improvements when indexing through Applications, closes #518

davidmezzetti4fd40f708601
diff --git a/src/python/txtai/app/base.py b/src/python/txtai/app/base.py
index c512e87e..61d8a659 100644
--- a/src/python/txtai/app/base.py
+++ b/src/python/txtai/app/base.py
@@ -360,7 +360,7 @@ class Application:
self.documents = Documents()
# Add documents
- self.documents.add(documents)
+ self.documents.add(list(documents))
# Return unmodified input documents
return documents
diff --git a/src/python/txtai/embeddings/base.py b/src/python/txtai/embeddings/base.py
index 2ed05a75..2d094932 100644
--- a/src/python/txtai/embeddings/base.py
+++ b/src/python/txtai/embeddings/base.py
@@ -956,8 +956,11 @@ class Embeddings:
"""
if "graph" in self.config:
+ # Get or create graph configuration
+ config = self.config["graph"] if self.config["graph"] else {}
+
# Create configuration with custom columns, if necessary
- config = self.columns(self.config["graph"])
+ config = self.columns(config)
return GraphFactory.create(config)
return None
diff --git a/src/python/txtai/graph/base.py b/src/python/txtai/graph/base.py
index 161b46f6..769c77ab 100644
--- a/src/python/txtai/graph/base.py
+++ b/src/python/txtai/graph/base.py
@@ -30,7 +30,7 @@ class Graph:
"""
# Graph configuration
- self.config = config
+ self.config = config if config else {}
# Graph backend
self.backend = None
@@ -504,8 +504,8 @@ class Graph:
self.cleartopics()
# Use community detection to get topics
- config = self.config["topics"]
- topics = Topics(config)
+ topics = Topics(self.config["topics"])
+ config = topics.config
self.topics = topics(self)
# Label each topic with a higher level category
diff --git a/src/python/txtai/graph/topics.py b/src/python/txtai/graph/topics.py
index 3bb4dc2a..dfe0cd11 100644
--- a/src/python/txtai/graph/topics.py
+++ b/src/python/txtai/graph/topics.py
@@ -19,7 +19,7 @@ class Topics:
config: topic configuration
"""
- self.config = config
+ self.config = config if config else {}
self.tokenizer = Tokenizer(stopwords=True)
# Additional stopwords to ignore when building topic names