Spaces:
Build error
Build error
| import os | |
| from qdrant_client import QdrantClient | |
| from qdrant_client.http.models import VectorParams, Distance | |
| COLLECTION = "esg_vectors" | |
| VECTOR_SIZE = 512 | |
| os.makedirs("qdrant_db", exist_ok=True) | |
| client = QdrantClient(path="qdrant_db") | |
| def init(): | |
| collections = [c.name for c in client.get_collections().collections] | |
| if COLLECTION not in collections: | |
| client.create_collection( | |
| collection_name=COLLECTION, | |
| vectors_config=VectorParams( | |
| size=VECTOR_SIZE, | |
| distance=Distance.COSINE | |
| ) | |
| ) | |
| init() |