mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-08-19 16:07:01 +00:00
wipe qdrant support
This commit is contained in:
parent
774e256052
commit
ac5fbe1fdd
@ -11,6 +11,7 @@ def wipe() -> None:
|
||||
"simple": wipe_simple, # node store
|
||||
"chroma": wipe_chroma, # vector store
|
||||
"postgres": wipe_postgres, # node, index and vector store
|
||||
"qdrant": wipe_qdrant, # vector store
|
||||
}
|
||||
for dbtype in ("nodestore", "vectorstore"):
|
||||
database = getattr(settings(), dbtype).database
|
||||
@ -93,11 +94,28 @@ def wipe_postgres(dbtype: str) -> None:
|
||||
conn.close()
|
||||
|
||||
|
||||
def wipe_chroma(dbtype: str):
|
||||
def wipe_chroma(dbtype: str) -> None:
|
||||
assert dbtype == "vectorstore"
|
||||
wipe_tree(str((local_data_path / "chroma_db").absolute()))
|
||||
|
||||
|
||||
def wipe_qdrant(dbtype: str) -> None:
|
||||
assert dbtype == "vectorstore"
|
||||
try:
|
||||
from qdrant_client import QdrantClient # type: ignore
|
||||
except ImportError:
|
||||
raise ImportError("Qdrant dependencies not found")
|
||||
client = QdrantClient(
|
||||
**settings().qdrant.model_dump(exclude_none=True)
|
||||
)
|
||||
collection_name = "make_this_parameterizable_per_api_call" # ?! see vector_store_component.py
|
||||
try:
|
||||
client.delete_collection(collection_name)
|
||||
print("Collection dropped successfully.")
|
||||
except Exception as e:
|
||||
print("Error dropping collection:", e)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
commands = {
|
||||
"wipe": wipe,
|
||||
|
Loading…
Reference in New Issue
Block a user