Skip to content

armgit / txtai

Public Imported from GitHub
0

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

Modify file delete

davidmezzettie83ee844c642
diff --git a/src/python/txtai/embeddings/base.py b/src/python/txtai/embeddings/base.py
index d0381349..211fa337 100644
--- a/src/python/txtai/embeddings/base.py
+++ b/src/python/txtai/embeddings/base.py
@@ -116,7 +116,9 @@ class Embeddings:
self.config["ids"] = ids
# Delete embeddings memmap buffer
- transform.remove(embeddings)
+ path = embeddings.filename
+ del embeddings
+ os.remove(path)
def upsert(self, documents):
"""
@@ -150,7 +152,9 @@ class Embeddings:
self.config["ids"] = self.config["ids"] + ids
# Delete embeddings memmap buffer
- transform.remove(embeddings)
+ path = embeddings.filename
+ del embeddings
+ os.remove(path)
def delete(self, ids):
"""
diff --git a/src/python/txtai/embeddings/transform.py b/src/python/txtai/embeddings/transform.py
index 42fcce6c..3c074124 100644
--- a/src/python/txtai/embeddings/transform.py
+++ b/src/python/txtai/embeddings/transform.py
@@ -138,18 +138,6 @@ class Transform:
self.database.insert(batch, self.offset)
self.offset += len(batch)
- def remove(self, embeddings):
- """
- Deletes an embeddings buffer and it's underlying file.
-
- Args:
- embeddings: embeddings
- """
-
- path = embeddings.filename
- del embeddings
- os.remove(path)
-
class Action(Enum):
"""