|
1 | | -- The name of the target [collection](https://qdrant.tech/documentation/concepts/collections) on the Qdrant local installation, |
2 | | - Qdrant server, or Qdrant Cloud cluster. |
3 | 1 | - For [Qdrant local](https://github.com/qdrant/qdrant), the path to the local Qdrant installation, for example: `/qdrant/local` |
4 | 2 | - For [Qdrant client-server](https://qdrant.tech/documentation/quickstart/), the Qdrant server URL, for example: `http://localhost:6333` |
5 | 3 | - For [Qdrant Cloud](https://qdrant.tech/documentation/cloud-intro/): |
|
14 | 12 | 4. Note the value of the **Endpoint** field, for example: `https://<random-guid>.<region-id>.<cloud-provider>.cloud.qdrant.io`. |
15 | 13 |
|
16 | 14 | - A [Qdrant API key](https://qdrant.tech/documentation/cloud/authentication/#create-api-keys). |
| 15 | + |
| 16 | +- The name of the target [collection](https://qdrant.tech/documentation/concepts/collections) on the Qdrant local installation, |
| 17 | + Qdrant server, or Qdrant Cloud cluster. |
| 18 | + |
| 19 | + Qdrant requires the target collection to exist before Unstructured can write to the collection. |
| 20 | + The following example code demonstrates the use of the [Python Qdrant Client](https://pypi.org/project/qdrant-client/) to create |
| 21 | + a collection on a Qdrant Cloud cluster, configuring the collection for vectors with 3072 dimensions: |
| 22 | + |
| 23 | + ```python Python |
| 24 | + from qdrant_client import QdrantClient, models |
| 25 | + import os |
| 26 | + |
| 27 | + client = QdrantClient( |
| 28 | + url=os.getenv("QDRANT_URL"), |
| 29 | + api_key=os.getenv("QDRANT_API_KEY") |
| 30 | + ) |
| 31 | + |
| 32 | + client.create_collection( |
| 33 | + collection_name=os.getenv("QDRANT_COLLECTION"), |
| 34 | + vectors_config=models.VectorParams( |
| 35 | + size=3072, |
| 36 | + distance=models.Distance.COSINE |
| 37 | + ) |
| 38 | + ) |
| 39 | + |
| 40 | + collection = client.get_collection( |
| 41 | + collection_name=os.getenv("QDRANT_COLLECTION") |
| 42 | + ) |
| 43 | + |
| 44 | + print(f"The collection named '{os.getenv("QDRANT_COLLECTION")}' exists and " + |
| 45 | + f"has a status of '{collection.status}'.") |
| 46 | + ``` |
0 commit comments