docs: Proofread Python snippets (#1255)

* docs: Proofread Python snippets

Signed-off-by: Anush008 <anushshetty90@gmail.com>

* docs: Fix index

Signed-off-by: Anush008 <anushshetty90@gmail.com>

* remove redundant comment

Signed-off-by: Anush008 <anushshetty90@gmail.com>

* Update configuration.md

* docs: fix typo filtering.md

* Update datadog.md

---------

Signed-off-by: Anush008 <anushshetty90@gmail.com>
This commit is contained in:
Anush
2024-10-31 05:56:39 +05:30
committed by GitHub
parent eba4946f7f
commit a869128a2a
9 changed files with 50 additions and 46 deletions
@@ -200,7 +200,7 @@ curl -X PUT http://localhost:6333/collections/{collection_name} \
```
```python
from qdrant_client import QdrantClient
from qdrant_client import QdrantClient, models
client = QdrantClient(url="http://localhost:6333")
@@ -980,6 +980,10 @@ discover_queries = [
limit=10,
),
]
client.query_batch_points(
collection_name="{collection_name}", requests=discover_queries
)
```
```typescript
@@ -1189,6 +1193,10 @@ discover_queries = [
limit=10,
),
]
client.query_batch_points(
collection_name="{collection_name}", requests=discover_queries
)
```
```typescript
@@ -1367,6 +1375,8 @@ POST /collections/{collection_name}/points/search/matrix/pairs
```python
from qdrant_client import QdrantClient, models
client = QdrantClient(url="http://localhost:6333")
client.search_matrix_pairs(
collection_name="{collection_name}",
sample=10,
@@ -1533,6 +1543,8 @@ POST /collections/{collection_name}/points/search/matrix/offsets
```python
from qdrant_client import QdrantClient, models
client = QdrantClient(url="http://localhost:6333")
client.search_matrix_offsets(
collection_name="{collection_name}",
sample=10,
@@ -449,7 +449,7 @@ Filtered points would be:
]
```
When using `must_not`, the clause becomes `true` if none if the conditions listed inside `should` is satisfied.
When using `must_not`, the clause becomes `true` if none of the conditions listed inside `should` is satisfied.
In this sense, `must_not` is equivalent to the expression `(NOT A) AND (NOT B) AND (NOT C)`.
### Clauses combination
@@ -89,7 +89,7 @@ client.query_points(
limit=20,
),
models.Prefetch(
query=[0.01, 0.45, 0.67, ...], # <-- dense vector
query=[0.01, 0.45, 0.67], # <-- dense vector
using="dense",
limit=20,
),
@@ -284,7 +284,7 @@ client.query_points(
using="mrl_byte",
limit=1000,
),
query=[0.01, 0.299, 0.45, 0.67, ...], # <-- full vector
query=[0.01, 0.299, 0.45, 0.67], # <-- full vector
using="full",
limit=10,
)
@@ -428,13 +428,13 @@ client = QdrantClient(url="http://localhost:6333")
client.query_points(
collection_name="{collection_name}",
prefetch=models.Prefetch(
query=[0.01, 0.45, 0.67, ...], # <-- dense vector
query=[0.01, 0.45, 0.67, 0.53], # <-- dense vector
limit=100,
),
query=[
[0.1, 0.2, ...], # <─┐
[0.2, 0.1, ...], # < ├─ multi-vector
[0.8, 0.9, ...], # < ┘
[0.1, 0.2, 0.32], # <─┐
[0.2, 0.1, 0.52], # < ├─ multi-vector
[0.8, 0.9, 0.93], # < ┘
],
using="colbert",
limit=10,
@@ -608,14 +608,14 @@ client.query_points(
using="mrl_byte",
limit=1000,
),
query=[0.01, 0.45, 0.67, ...], # <-- full dense vector
query=[0.01, 0.45, 0.67], # <-- full dense vector
using="full",
limit=100,
),
query=[
[0.1, 0.2, ...], # <─┐
[0.2, 0.1, ...], # < ├─ multi-vector
[0.8, 0.9, ...], # < ┘
[0.17, 0.23, 0.52], # <─┐
[0.22, 0.11, 0.63], # < ├─ multi-vector
[0.86, 0.93, 0.12], # < ┘
],
using="colbert",
limit=10,
@@ -913,7 +913,7 @@ client.query_points(
collection_name="{collection_name}",
query="43cf51e2-8777-4f52-bc74-c2cbde0c8b04", # <--- point id
using="512d-vector",
lookup_from=models.LookupFrom(
lookup_from=models.LookupLocation(
collection="another_collection", # <--- other collection name
vector="image-512", # <--- vector name in the other collection
)
@@ -1079,21 +1079,21 @@ client.query_points(
collection_name="{collection_name}",
prefetch=[
models.Prefetch(
query=[0.01, 0.45, 0.67, ...], # <-- dense vector
query=[0.01, 0.45, 0.67], # <-- dense vector
filter=models.Filter(
must=models.FieldCondition(
key="color",
match=models.Match(value="red"),
match=models.MatchValue(value="red"),
),
),
limit=10,
),
models.Prefetch(
query=[0.01, 0.45, 0.67, ...], # <-- dense vector
query=[0.01, 0.45, 0.67], # <-- dense vector
filter=models.Filter(
must=models.FieldCondition(
key="color",
match=models.Match(value="green"),
match=models.MatchValue(value="green"),
),
),
limit=10,
@@ -41,7 +41,7 @@ client = QdrantClient(url="http://localhost:6333")
client.create_payload_index(
collection_name="{collection_name}",
field_name="name_of_the_field_to_index",
field_schema="keyword",
field_schema=models.PayloadSchemaType.KEYWORD,
)
```
@@ -520,7 +520,7 @@ client.create_payload_index(
collection_name="{collection_name}",
field_name="payload_field_name",
field_schema=models.KeywordIndexParams(
type="keyword",
type=models.KeywordIndexType.KEYWORD,
on_disk=True,
),
)
@@ -677,7 +677,7 @@ client.create_payload_index(
collection_name="{collection_name}",
field_name="payload_field_name",
field_schema=models.KeywordIndexParams(
type="keyword",
type=models.KeywordIndexType.KEYWORD,
is_tenant=True,
),
)
@@ -814,8 +814,8 @@ PUT /collections/{collection_name}/index
client.create_payload_index(
collection_name="{collection_name}",
field_name="timestamp",
field_schema=models.KeywordIndexParams(
type="integer",
field_schema=models.IntegerIndexParams(
type=models.IntegerIndexType.INTEGER,
is_principal=True,
),
)
@@ -834,7 +834,7 @@ client.createPayloadIndex("{collection_name}", {
```rust
use qdrant_client::qdrant::{
CreateFieldIndexCollectionBuilder,
IntegerdIndexParamsBuilder,
IntegerIndexParamsBuilder,
FieldType
};
use qdrant_client::{Qdrant, QdrantError};
@@ -848,7 +848,7 @@ client.create_field_index(
FieldType::Integer,
)
.field_index_params(
IntegerdIndexParamsBuilder::default()
IntegerIndexParamsBuilder::default()
.is_principal(true),
),
);
@@ -1705,13 +1705,6 @@ REST API ([Schema](https://api.qdrant.tech/api-reference/points/get-point)):
GET /collections/{collection_name}/points/{point_id}
```
<!--
Python client:
```python
```
-->
## Scroll points
Sometimes it might be necessary to get all stored points without knowing ids, or iterate over points that correspond to a filter.
@@ -108,6 +108,7 @@ client = QdrantClient(url="http://localhost:6333")
client.create_collection(
collection_name="{collection_name}",
vectors_config={},
sparse_vectors_config={
"text": models.SparseVectorParams(),
},
@@ -380,7 +381,7 @@ client = QdrantClient(url="http://localhost:6333")
result = client.query_points(
collection_name="{collection_name}",
query_vector=models.SparseVector(indices=[1, 3, 5, 7], values=[0.1, 0.2, 0.3, 0.4]),
query=models.SparseVector(indices=[1, 3, 5, 7], values=[0.1, 0.2, 0.3, 0.4]),
using="text",
).points
```
@@ -672,9 +673,9 @@ client.upsert(
models.PointStruct(
id=1,
vector=[
[-0.013, 0.020, -0.007, -0.111, ...],
[-0.030, -0.055, 0.001, 0.072, ...],
[-0.041, 0.014, -0.032, -0.062, ...]
[-0.013, 0.020, -0.007, -0.111],
[-0.030, -0.055, 0.001, 0.072],
[-0.041, 0.014, -0.032, -0.062]
],
)
],
@@ -824,9 +825,9 @@ client = QdrantClient(url="http://localhost:6333")
client.query_points(
collection_name="{collection_name}",
query=[
[-0.013, 0.020, -0.007, -0.111, ...],
[-0.030, -0.055, 0.001, 0.072, ...],
[-0.041, 0.014, -0.032, -0.062, ...]
[-0.013, 0.020, -0.007, -0.111],
[-0.030, -0.055, 0.001, 0.072],
[-0.041, 0.014, -0.032, -0.062]
],
)
```
@@ -1598,13 +1599,11 @@ client = QdrantClient(url="http://localhost:6333")
client.create_collection(
collection_name="{collection_name}",
vectors_config=models.VectorParams(
size=128,
distance=models.Distance.COSINE,
datatype=models.Datatype.UINT8
size=128, distance=models.Distance.COSINE, datatype=models.Datatype.UINT8
),
sparse_vectors_config={
"text": models.SparseVectorParams(
index=models.SparseIndexConfig(datatype=models.Datatype.UINT8)
index=models.SparseIndexParams(datatype=models.Datatype.UINT8)
),
},
)