Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai krishna committed Nov 5, 2024
1 parent 32bf746 commit 3e4ae8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 4 additions & 2 deletions backend/modules/vector_db/chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
from langchain.embeddings.base import Embeddings
from langchain_community.vectorstores import Chroma

from backend.constants import DATA_POINT_FQN_METADATA_KEY, DEFAULT_BATCH_SIZE_FOR_VECTOR_STORE
from backend.constants import (
DATA_POINT_FQN_METADATA_KEY,
DEFAULT_BATCH_SIZE_FOR_VECTOR_STORE,
)
from backend.logger import logger
from backend.modules.vector_db.base import BaseVectorDB
from backend.types import ChromaVectorDBConfig, DataPointVector
Expand Down Expand Up @@ -104,7 +107,6 @@ def upsert_documents(
for doc in documents
if doc.metadata.get(DATA_POINT_FQN_METADATA_KEY)
]


def delete_documents(self, collection_name: str, document_ids: List[str]):
# Fetch the collection
Expand Down
9 changes: 3 additions & 6 deletions backend/modules/vector_db/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,16 @@ def upsert_documents(
)

# Delete old documents

# If there are no record ids to be upserted, return
if not len(record_ids_to_be_upserted):
return

logger.debug(
f"[Qdrant] Deleting {len(documents)} outdated documents from collection {collection_name}"
)
for i in range(0, len(record_ids_to_be_upserted), BATCH_SIZE):
record_ids_to_be_processed = record_ids_to_be_upserted[
i : i + BATCH_SIZE
]
record_ids_to_be_processed = record_ids_to_be_upserted[i : i + BATCH_SIZE]
self.qdrant_client.delete(
collection_name=collection_name,
points_selector=models.PointIdsList(
Expand Down Expand Up @@ -420,4 +418,3 @@ def list_document_vector_points(
f"[Qdrant] Listing {len(document_vector_points)} document vector points for collection {collection_name}"
)
return document_vector_points

0 comments on commit 3e4ae8c

Please sign in to comment.