Skip to content

Instantly share code, notes, and snippets.

@idontcalculate
Created July 21, 2024 16:09
Show Gist options
  • Save idontcalculate/0653afdf891a954bbe0de709a5c9d9bf to your computer and use it in GitHub Desktop.
Save idontcalculate/0653afdf891a954bbe0de709a5c9d9bf to your computer and use it in GitHub Desktop.
from qdrant_client import QdrantClient
from qdrant_client.http.models import Distance, VectorParams
from config import QDRANT_API_KEY, QDRANT_URL
def get_qdrant_client():
qdrant_client = QdrantClient(
url=QDRANT_URL,
api_key=QDRANT_API_KEY,
)
# Ensure the collection exists
collection_name=COLLECTION_NAME
collection_name = "library"
if not qdrant_client.collection_exists(collection_name):
qdrant_client.create_collection(
collection_name=collection_name,
vectors_config=VectorParams(size=768, distance=Distance.COSINE),
)
return qdrant_client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment