mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-28 23:48:31 +02:00
fix headings
This commit is contained in:
@@ -56,7 +56,7 @@ client = QdrantClient("localhost")
|
||||
The default client only exposes the synchronous methods for interacting with the server. To access the async client and it's underlying methods, you need to use autogenerated async clients.
|
||||
It is possible to use asynchronous HTTP API by using `qdrant_client.http.api_client.AsyncApis`. We recommend you use the asynchronous gRPC API, as it is more efficient than the HTTP API.
|
||||
|
||||
### gRPC API
|
||||
## Using the gRPC API
|
||||
|
||||
Every instance of `QdrantClient` has two properties: `async_grpc_collections` and `async_grpc_points`. They expose
|
||||
the autogenerated clients for [collections](/documentation/concepts/collections/) and [points](/documentation/concepts/points/) respectively.
|
||||
@@ -71,7 +71,7 @@ from qdrant_client import grpc
|
||||
If your IDE does not support autocompletion for the autogenerated clients, you can refer to the documentation and [see the available
|
||||
fields for each of them](https://github.com/qdrant/qdrant/blob/master/docs/grpc/docs.md).
|
||||
|
||||
#### Creating a collection
|
||||
## Step 1: Create a collection
|
||||
|
||||
Let's create a collection and add some points to it.
|
||||
|
||||
@@ -99,7 +99,7 @@ response = await client.async_grpc_collections.Create(
|
||||
Our collection was set up for 100-dimensional vectors, cosine distance and 8-bit quantization. The timeout is set to 10 seconds, so
|
||||
if the server does not respond within 10 seconds, the request will be aborted.
|
||||
|
||||
#### Checking collection info
|
||||
### Verify collection info
|
||||
|
||||
You can check the collection info to see if it was created and properly configured:
|
||||
|
||||
@@ -173,7 +173,7 @@ As you can see, the collection was created properly and is ready to be used. To
|
||||
[API specification](https://qdrant.github.io/qdrant/redoc/index.html#tag/collections/operation/get_collection) that describes the
|
||||
meaning of each parameter.
|
||||
|
||||
##### Handling exceptions
|
||||
### Handling exceptions
|
||||
|
||||
If the collection does not exist, the server will return an error. We can handle it by catching the exception. We may expect
|
||||
some specific exceptions, or simply catch all the errors that subclass `RpcError` from `grpc` package:
|
||||
@@ -204,7 +204,7 @@ Our exception contain the details about the error, including the status code and
|
||||
We can use those details to properly handle some specific cases. For example, if we want to create a collection only if it does not
|
||||
exist, we can check the status code and create it if it is `StatusCode.NOT_FOUND`:
|
||||
|
||||
#### Updating collection configuration
|
||||
## Step 2: Update collection configuration
|
||||
|
||||
It's quite likely that we will want to update the collection configuration. For example, we may want to change the HNSW parameters to improve
|
||||
the search precision. Let's change the `ef_construct` parameter to 200:
|
||||
@@ -220,7 +220,7 @@ await client.async_grpc_collections.Update(
|
||||
)
|
||||
```
|
||||
|
||||
#### Deleting a collection
|
||||
### Delete a collection
|
||||
|
||||
There are plenty of methods available for collections, such as creating aliases or checking the status of the cluster. This tutorial won't use all of them, but you can always [check the list of available methods and their parameters in the
|
||||
documentation](https://github.com/qdrant/qdrant/blob/master/docs/grpc/docs.md#collections_serviceproto).
|
||||
@@ -236,7 +236,7 @@ await client.async_grpc_collections.Delete(
|
||||
```
|
||||
That's it when it comes to collection management. Let's move on to points (individual vectors) allowing us to load data into our collection
|
||||
|
||||
#### Adding points to the collection
|
||||
## Step 3: Add points to the collection
|
||||
|
||||
Assuming your collection was created successfuly, you can now add some
|
||||
points to it. Let's add our first two points into the collection:
|
||||
@@ -279,7 +279,7 @@ Those points are automatically indexed and available for search. In the future,
|
||||
|
||||
The main operation you need from the vector database is semantic search. Let's see how to perform it.
|
||||
|
||||
#### Asynchronous semantic search
|
||||
## Step 4: Run a query
|
||||
|
||||
The search operation requires a query vector and a collection name. You can also specify the number of results you want to retrieve and some other parameters. A minimal example might look like this:
|
||||
|
||||
@@ -308,7 +308,7 @@ result {
|
||||
time: 0.000456134
|
||||
```
|
||||
|
||||
##### Returning vectors and payloads
|
||||
### Return vectors and payloads
|
||||
|
||||
If you need the vectors and payloads of the points, you can specify it in the request:
|
||||
|
||||
@@ -326,7 +326,7 @@ response = await client.async_grpc_points.Search(
|
||||
|
||||
That's all the code you need to bring back the vector and payload.
|
||||
|
||||
##### Applying filters
|
||||
## Step 5: Add a filter
|
||||
|
||||
If you ever used SQL, you are probably familiar with the `WHERE` clause. It lets you filter the results of the query. Qdrant has a similar functionality. Imagine you want to find all the points similar to given vector, but with `int_param` equal to 32. You can do it like this:
|
||||
|
||||
@@ -355,7 +355,7 @@ You can build even more sophisticated filters with the `must`, `should` and `mus
|
||||
|
||||
Analogous to search, you can also [scroll our collection](https://qdrant.tech/documentation/concepts/points/#scroll-points) to retrieve all the points or use the [recommendation API](https://qdrant.tech/documentation/concepts/search/#recommendation-api) to find points similar to positive and dissimilar to negative examples.
|
||||
|
||||
## Support of Qdrant async API in Python libraries
|
||||
## Supported Python libraries
|
||||
|
||||
Qdrant integrates with numerous Python libraries. Until recently, only [Langchain]() provided async Python API support.
|
||||
Qdrant is the only vector database with full coverage of async API in Langchain. Their documentation [describes how to use
|
||||
|
||||
Reference in New Issue
Block a user