Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace search with query_points, remove min python requirement … #868

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Insert vectors into a collection

```python
import numpy as np

from qdrant_client.models import PointStruct

vectors = np.random.rand(100, 100)
Expand All @@ -204,9 +205,9 @@ Search for similar vectors

```python
query_vector = np.random.rand(100)
hits = client.search(
hits = client.query_points(
collection_name="my_collection",
query_vector=query_vector,
query=query_vector,
limit=5 # Return 5 closest points
)
```
Expand All @@ -216,9 +217,9 @@ Search for similar vectors with filtering condition
```python
from qdrant_client.models import Filter, FieldCondition, Range

hits = client.search(
hits = client.query_points(
collection_name="my_collection",
query_vector=query_vector,
query=query_vector,
query_filter=Filter(
must=[ # These conditions are required for search results
FieldCondition(
Expand Down Expand Up @@ -253,10 +254,13 @@ Starting from version 1.6.1, all python client methods are available in async ve
To use it, just import `AsyncQdrantClient` instead of `QdrantClient`:

```python
from qdrant_client import AsyncQdrantClient, models
import numpy as np
import asyncio

import numpy as np

from qdrant_client import AsyncQdrantClient, models


async def main():
# Your async code using QdrantClient might be put here
client = AsyncQdrantClient(url="http://localhost:6333")
Expand All @@ -277,9 +281,9 @@ async def main():
],
)

res = await client.search(
res = await client.query_points(
collection_name="my_collection",
query_vector=np.random.rand(10).tolist(), # type: ignore
query=np.random.rand(10).tolist(), # type: ignore
limit=10,
)

Expand All @@ -296,5 +300,3 @@ More examples can be found [here](./tests/test_async_qdrant_client.py).
This project uses git hooks to run code formatters.

Install `pre-commit` with `pip3 install pre-commit` and set up hooks with `pre-commit install`.

> pre-commit requires python>=3.8
Loading