docs: Query API snippets with Python (#1095)

Co-authored-by: generall <andrey@vasnetsov.com>
This commit is contained in:
Anush
2024-08-23 22:48:27 +05:30
committed by GitHub
co-authored by generall
parent 4821e18664
commit e9fa9be0a4
17 changed files with 203 additions and 195 deletions
@@ -192,11 +192,12 @@ client.upload_points(
Now that the data is stored in Qdrant, you can ask it questions and receive semantically relevant results.
```python
hits = client.search(
hits = client.query_points(
collection_name="my_books",
query_vector=encoder.encode("alien invasion").tolist(),
query=encoder.encode("alien invasion").tolist(),
limit=3,
)
).points
for hit in hits:
print(hit.payload, "score:", hit.score)
```
@@ -216,14 +217,15 @@ The search engine shows three of the most likely responses that have to do with
How about the most recent book from the early 2000s?
```python
hits = client.search(
hits = client.query_points(
collection_name="my_books",
query_vector=encoder.encode("alien invasion").tolist(),
query=encoder.encode("alien invasion").tolist(),
query_filter=models.Filter(
must=[models.FieldCondition(key="year", range=models.Range(gte=2000))]
),
limit=1,
)
).points
for hit in hits:
print(hit.payload, "score:", hit.score)
```