Pre-pgvector migration checkpoint — upsert, allow_replace_deleted, maintenance timer

This commit is contained in:
2026-04-26 20:19:49 +00:00
parent 72c8d1ef2c
commit d2eed98906
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ embedder = SentenceTransformer("all-MiniLM-L6-v2")
chroma_client = chromadb.PersistentClient(path=DB_PATH) chroma_client = chromadb.PersistentClient(path=DB_PATH)
collection = chroma_client.get_or_create_collection( collection = chroma_client.get_or_create_collection(
name="aaronai", name="aaronai",
metadata={"hnsw:space": "cosine"} metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
) )
anthropic_client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY")) anthropic_client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
+1 -1
View File
@@ -122,7 +122,7 @@ def retrieve(mode, task=None, project=None, n_results=8):
client = chromadb.PersistentClient(path=DB_PATH) client = chromadb.PersistentClient(path=DB_PATH)
collection = client.get_or_create_collection( collection = client.get_or_create_collection(
name="aaronai", name="aaronai",
metadata={"hnsw:space": "cosine"} metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
) )
low, high = MODE_RANGES[mode] low, high = MODE_RANGES[mode]
+1 -1
View File
@@ -18,7 +18,7 @@ db_path = str(Path.home() / "aaronai" / "db")
client = chromadb.PersistentClient(path=db_path) client = chromadb.PersistentClient(path=db_path)
collection = client.get_or_create_collection( collection = client.get_or_create_collection(
name="aaronai", name="aaronai",
metadata={"hnsw:space": "cosine"} metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
) )
def extract_text_from_docx(path): def extract_text_from_docx(path):
+1 -1
View File
@@ -14,7 +14,7 @@ embedder = SentenceTransformer("all-MiniLM-L6-v2")
client = chromadb.PersistentClient(path=db_path) client = chromadb.PersistentClient(path=db_path)
collection = client.get_or_create_collection( collection = client.get_or_create_collection(
name="aaronai", name="aaronai",
metadata={"hnsw:space": "cosine"} metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
) )
def extract_messages(convo): def extract_messages(convo):
+3 -3
View File
@@ -13,7 +13,7 @@ embedder = SentenceTransformer("all-MiniLM-L6-v2")
client = chromadb.PersistentClient(path=db_path) client = chromadb.PersistentClient(path=db_path)
collection = client.get_or_create_collection( collection = client.get_or_create_collection(
name="aaronai", name="aaronai",
metadata={"hnsw:space": "cosine"} metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
) )
def extract_messages(convo): def extract_messages(convo):
@@ -102,7 +102,7 @@ def ingest_conversations(path):
continue continue
embeddings = embedder.encode([n[1] for n in new]).tolist() embeddings = embedder.encode([n[1] for n in new]).tolist()
collection.add( collection.upsert(
ids=[n[0] for n in new], ids=[n[0] for n in new],
documents=[n[1] for n in new], documents=[n[1] for n in new],
metadatas=[n[2] for n in new], metadatas=[n[2] for n in new],
@@ -138,7 +138,7 @@ def ingest_memories(path):
collection.delete(ids=[chunk_id]) collection.delete(ids=[chunk_id])
embedding = embedder.encode([chunk_text]).tolist() embedding = embedder.encode([chunk_text]).tolist()
collection.add( collection.upsert(
ids=[chunk_id], ids=[chunk_id],
documents=[chunk_text], documents=[chunk_text],
metadatas=[{ metadatas=[{