-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqdrantdb.py
More file actions
22 lines (19 loc) · 834 Bytes
/
qdrantdb.py
File metadata and controls
22 lines (19 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from qdrant_client import QdrantClient
#import qdrant_client
from qdrant_client.models import Distance, VectorParams
#qdrant = QdrantClient(":memory:") # Create in-memory Qdrant instance, for testing, CI/CD
# OR
#client = QdrantClient(path="path/to/db") # Persists changes to disk, fast prototyping
client = QdrantClient("http://localhost:6333") # Connect to existing Qdrant instance
collection_name = "SpeakerRecognition"
# Check if collection exists
if client.collection_exists(collection_name):
pass
#print(f"Collection '{collection_name}' already exists.")
else:
# Create the collection
client.create_collection(
collection_name=collection_name,
vectors_config=VectorParams(size=192, distance=Distance.COSINE),)
#print(f"Collection '{collection_name}' created.")
#client = QdrantClient(":memory:")