Pre-pgvector migration checkpoint — upsert, allow_replace_deleted, maintenance timer
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ embedder = SentenceTransformer("all-MiniLM-L6-v2")
|
||||
chroma_client = chromadb.PersistentClient(path=DB_PATH)
|
||||
collection = chroma_client.get_or_create_collection(
|
||||
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"))
|
||||
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ def retrieve(mode, task=None, project=None, n_results=8):
|
||||
client = chromadb.PersistentClient(path=DB_PATH)
|
||||
collection = client.get_or_create_collection(
|
||||
name="aaronai",
|
||||
metadata={"hnsw:space": "cosine"}
|
||||
metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
|
||||
)
|
||||
|
||||
low, high = MODE_RANGES[mode]
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ db_path = str(Path.home() / "aaronai" / "db")
|
||||
client = chromadb.PersistentClient(path=db_path)
|
||||
collection = client.get_or_create_collection(
|
||||
name="aaronai",
|
||||
metadata={"hnsw:space": "cosine"}
|
||||
metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
|
||||
)
|
||||
|
||||
def extract_text_from_docx(path):
|
||||
|
||||
@@ -14,7 +14,7 @@ embedder = SentenceTransformer("all-MiniLM-L6-v2")
|
||||
client = chromadb.PersistentClient(path=db_path)
|
||||
collection = client.get_or_create_collection(
|
||||
name="aaronai",
|
||||
metadata={"hnsw:space": "cosine"}
|
||||
metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
|
||||
)
|
||||
|
||||
def extract_messages(convo):
|
||||
|
||||
@@ -13,7 +13,7 @@ embedder = SentenceTransformer("all-MiniLM-L6-v2")
|
||||
client = chromadb.PersistentClient(path=db_path)
|
||||
collection = client.get_or_create_collection(
|
||||
name="aaronai",
|
||||
metadata={"hnsw:space": "cosine"}
|
||||
metadata={"hnsw:space": "cosine", "hnsw:allow_replace_deleted": True}
|
||||
)
|
||||
|
||||
def extract_messages(convo):
|
||||
@@ -102,7 +102,7 @@ def ingest_conversations(path):
|
||||
continue
|
||||
|
||||
embeddings = embedder.encode([n[1] for n in new]).tolist()
|
||||
collection.add(
|
||||
collection.upsert(
|
||||
ids=[n[0] for n in new],
|
||||
documents=[n[1] for n in new],
|
||||
metadatas=[n[2] for n in new],
|
||||
@@ -138,7 +138,7 @@ def ingest_memories(path):
|
||||
collection.delete(ids=[chunk_id])
|
||||
|
||||
embedding = embedder.encode([chunk_text]).tolist()
|
||||
collection.add(
|
||||
collection.upsert(
|
||||
ids=[chunk_id],
|
||||
documents=[chunk_text],
|
||||
metadatas=[{
|
||||
|
||||
Reference in New Issue
Block a user