Created
July 21, 2024 16:09
-
-
Save idontcalculate/0653afdf891a954bbe0de709a5c9d9bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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