Skip to content

Commit

Permalink
Refactor BaseVectorIndex delete method (#1853)
Browse files Browse the repository at this point in the history
  • Loading branch information
waltcow authored Dec 30, 2023
1 parent 936c3cc commit 06d2d8c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions api/core/index/vector_index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from langchain.embeddings.base import Embeddings
from langchain.schema import Document, BaseRetriever
from langchain.vectorstores import VectorStore
from weaviate import UnexpectedStatusCodeException

from core.index.base import BaseIndex
from extensions.ext_database import db
Expand Down Expand Up @@ -139,10 +138,8 @@ def recreate_dataset(self, dataset: Dataset):

try:
self.delete()
except UnexpectedStatusCodeException as e:
if e.status_code != 400:
# 400 means index not exists
raise e
except Exception as e:
raise e

dataset_documents = db.session.query(DatasetDocument).filter(
DatasetDocument.dataset_id == dataset.id,
Expand Down Expand Up @@ -194,10 +191,8 @@ def create_qdrant_dataset(self, dataset: Dataset):

try:
self.delete()
except UnexpectedStatusCodeException as e:
if e.status_code != 400:
# 400 means index not exists
raise e
except Exception as e:
raise e

dataset_documents = db.session.query(DatasetDocument).filter(
DatasetDocument.dataset_id == dataset.id,
Expand Down

0 comments on commit 06d2d8c

Please sign in to comment.