Skip to content

Commit 94d3e16

Browse files
committed
fix: fix docstrings to make sphinx happy (#814)
* fix: fix docstrings to make sphinx happy * debug: downgrade poetry version * fix: update virtualenv * debug: remove debug line
1 parent 8051990 commit 94d3e16

File tree

5 files changed

+208
-215
lines changed

5 files changed

+208
-215
lines changed

qdrant_client/async_qdrant_client.py

Lines changed: 97 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,7 @@ async def query_points(
431431
- If `SparseVector` - use as a sparse vector for nearest search.
432432
- If `Query` - use as a query for specific search type.
433433
- If `NumpyArray` - use as a dense vector for nearest search.
434-
- If `Document` - infer vector from the document text and use
435-
it for nearest search (requires `fastembed` package installed).
434+
- If `Document` - infer vector from the document text and use it for nearest search (requires `fastembed` package installed).
436435
- If `None` - return first `limit` points from the collection.
437436
prefetch: prefetch queries to make a selection of the data to be used with the main query
438437
query_filter:
@@ -569,8 +568,7 @@ async def query_points_groups(
569568
- If `SparseVector` - use as a sparse vector for nearest search.
570569
- If `Query` - use as a query for specific search type.
571570
- If `NumpyArray` - use as a dense vector for nearest search.
572-
- If `Document` - infer vector from the document text and use
573-
it for nearest search (requires `fastembed` package installed).
571+
- If `Document` - infer vector from the document text and use it for nearest search (requires `fastembed` package installed).
574572
- If `None` - return first `limit` points from the collection.
575573
prefetch: prefetch queries to make a selection of the data to be used with the main query
576574
query_filter:
@@ -579,8 +577,7 @@ async def query_points_groups(
579577
search_params: Additional search params
580578
limit: How many results return
581579
group_size: How many results return for each group
582-
group_by: Name of the payload field to group by.
583-
Field must be of type "keyword" or "integer".
580+
group_by: Name of the payload field to group by. Field must be of type "keyword" or "integer".
584581
Nested fields are specified using dot notation, e.g. "nested_field.subfield".
585582
with_payload:
586583
- Specify which stored payload should be attached to the result.
@@ -924,26 +921,26 @@ async def search_matrix_pairs(
924921
shard_key_selector: Optional[types.ShardKeySelector] = None,
925922
**kwargs: Any,
926923
) -> types.SearchMatrixPairsResponse:
927-
"""Compute distance matrix for sampled points with a pair-based output format.
924+
"""
925+
Compute distance matrix for sampled points with a pair-based output format.
926+
928927
Args:
929-
collection_name: Name of the collection
930-
query_filter: Filter to apply
931-
limit: How many neighbours per sample to find
932-
sample: How many points to select and search within
933-
using: Name of the vectors to use for search.
934-
If `None` - use default vectors.
935-
consistency:
936-
Read consistency of the search. Defines how many replicas should be queried before returning the result. Values:
937-
- int - number of replicas to query, values should present in all queried replicas
938-
- 'majority' - query all replicas, but return values present in the majority of replicas
939-
- 'quorum' - query the majority of replicas, return values present in all of them
940-
- 'all' - query all replicas, and return values present in all replicas
928+
collection_name: Name of the collection.
929+
query_filter: Filter to apply.
930+
limit: How many neighbors per sample to find.
931+
sample: How many points to select and search within.
932+
using: Name of the vectors to use for search. If `None`, use default vectors.
933+
consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. Values:
934+
- int: Number of replicas to query, values should be present in all queried replicas.
935+
- 'majority': Query all replicas, but return values present in the majority of replicas.
936+
- 'quorum': Query the majority of replicas, return values present in all of them.
937+
- 'all': Query all replicas, and return values present in all replicas.
941938
timeout: Overrides global timeout for this search. Unit is seconds.
942-
shard_key_selector:
943-
This parameter allows to specify which shards should be queried.
944-
If `None` - query all shards. Only works for collections with `custom` sharding method.
939+
shard_key_selector: This parameter allows specifying which shards should be queried.
940+
If `None`, query all shards. Only works for collections with the `custom` sharding method.
941+
945942
Returns:
946-
Return distance matrix using a pair-based encoding.
943+
Distance matrix using a pair-based encoding.
947944
"""
948945
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
949946
return await self._client.search_matrix_pairs(
@@ -970,26 +967,26 @@ async def search_matrix_offsets(
970967
shard_key_selector: Optional[types.ShardKeySelector] = None,
971968
**kwargs: Any,
972969
) -> types.SearchMatrixOffsetsResponse:
973-
"""Compute distance matrix for sampled points with an offset-based output format.
970+
"""
971+
Compute distance matrix for sampled points with an offset-based output format.
972+
974973
Args:
975-
collection_name: Name of the collection
976-
query_filter: Filter to apply
977-
limit: How many neighbours per sample to find
978-
sample: How many points to select and search within
979-
using: Name of the vectors to use for search.
980-
If `None` - use default vectors.
981-
consistency:
982-
Read consistency of the search. Defines how many replicas should be queried before returning the result. Values:
983-
- int - number of replicas to query, values should present in all queried replicas
984-
- 'majority' - query all replicas, but return values present in the majority of replicas
985-
- 'quorum' - query the majority of replicas, return values present in all of them
986-
- 'all' - query all replicas, and return values present in all replicas
974+
collection_name: Name of the collection.
975+
query_filter: Filter to apply.
976+
limit: How many neighbors per sample to find.
977+
sample: How many points to select and search within.
978+
using: Name of the vectors to use for search. If `None`, use default vectors.
979+
consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. Values:
980+
- int: Number of replicas to query, values should present in all queried replicas.
981+
- 'majority': Query all replicas, but return values present in the majority of replicas.
982+
- 'quorum': Query the majority of replicas, return values present in all of them.
983+
- 'all': Query all replicas and return values present in all replicas.
987984
timeout: Overrides global timeout for this search. Unit is seconds.
988-
shard_key_selector:
989-
This parameter allows to specify which shards should be queried.
990-
If `None` - query all shards. Only works for collections with `custom` sharding method.
985+
shard_key_selector: This parameter allows specifying which shards should be queried.
986+
If `None`, query all shards. Only works for collections with the `custom` sharding method.
987+
991988
Returns:
992-
Return distance matrix using an offset-based encoding.
989+
Distance matrix using an offset-based encoding.
993990
"""
994991
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
995992
return await self._client.search_matrix_offsets(
@@ -1513,7 +1510,7 @@ async def delete_vectors(
15131510
collection_name (str): Name of the collection to delete vector from
15141511
vectors: List of names of the vectors to delete. Use `""` to delete the default vector. At least one vector should be specified.
15151512
points (Point): Selects points based on list of IDs or filter
1516-
Examples
1513+
Examples:
15171514
15181515
- `points=[1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90"]`
15191516
- `points=Filter(must=[FieldCondition(key='rand_number', range=Range(gte=0.7))])`
@@ -1620,7 +1617,7 @@ async def delete(
16201617
- If `true`, result will be returned only when all changes are applied
16211618
- If `false`, result will be returned immediately after the confirmation of receiving.
16221619
points_selector: Selects points based on list of IDs or filter.
1623-
Examples
1620+
Examples:
16241621
16251622
- `points=[1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90"]`
16261623
- `points=Filter(must=[FieldCondition(key='rand_number', range=Range(gte=0.7))])`
@@ -1659,81 +1656,76 @@ async def set_payload(
16591656
shard_key_selector: Optional[types.ShardKeySelector] = None,
16601657
**kwargs: Any,
16611658
) -> types.UpdateResult:
1662-
"""Modifies payload of the specified points
1659+
"""
1660+
Modifies payload of the specified points.
16631661
16641662
Examples:
16651663
1666-
`Set payload`::
1664+
`Set payload`::
16671665
1668-
# Assign payload value with key `"key"` to points 1, 2, 3.
1669-
# If payload value with specified key already exists - it will be overwritten
1670-
qdrant_client.set_payload(
1671-
collection_name="test_collection",
1672-
wait=True,
1673-
payload={
1674-
"key": "value"
1675-
},
1676-
points=[1,2,3]
1677-
)
1666+
# Assign payload value with key `"key"` to points 1, 2, 3.
1667+
# If payload value with specified key already exists - it will be overwritten
1668+
qdrant_client.set_payload(
1669+
collection_name="test_collection",
1670+
wait=True,
1671+
payload={
1672+
"key": "value"
1673+
},
1674+
points=[1, 2, 3]
1675+
)
16781676
16791677
Args:
1680-
collection_name: Name of the collection
1678+
collection_name: Name of the collection.
16811679
wait: Await for the results to be processed.
1682-
1683-
- If `true`, result will be returned only when all changes are applied
1684-
- If `false`, result will be returned immediately after the confirmation of receiving.
1685-
payload: Key-value pairs of payload to assign
1686-
points: List of affected points, filter or points selector
1687-
Example
1688-
1680+
- If `true`, the result will be returned only when all changes are applied.
1681+
- If `false`, the result will be returned immediately after confirmation of receipt.
1682+
payload: Key-value pairs of payload to assign.
1683+
points: List of affected points, filter, or points selector.
1684+
Example:
16891685
- `points=[1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90"]`
16901686
- `points=Filter(must=[FieldCondition(key='rand_number', range=Range(gte=0.7))])`
16911687
ordering (Optional[WriteOrdering]): Define strategy for ordering of the points. Possible values:
1692-
1693-
- `weak` (default) - write operations may be reordered, works faster
1694-
- `medium` - write operations go through dynamically selected leader, may be inconsistent for a short period of time in case of leader change
1695-
- `strong` - Write operations go through the permanent leader, consistent, but may be unavailable if leader is down
1696-
1697-
shard_key_selector:
1698-
Defines the shard groups that should be used to write updates into.
1699-
If multiple shard_keys are provided, the update will be written to each of them.
1700-
Only works for collections with `custom` sharding method.
1701-
1702-
key: Path to the nested field in the payload to modify. If not specified - modify the root of the
1703-
payload. E.g.:
1704-
1705-
PointStruct(
1706-
id=42,
1707-
vector=[...],
1708-
payload={
1709-
"recipe": {
1710-
"fruits": {"apple": "100g"}
1688+
- `weak` (default): Write operations may be reordered, works faster.
1689+
- `medium`: Write operations go through a dynamically selected leader, may be inconsistent for a short period of time in case of leader change.
1690+
- `strong`: Write operations go through the permanent leader, consistent, but may be unavailable if the leader is down.
1691+
shard_key_selector: Defines the shard groups that should be used to write updates into.
1692+
If multiple shard keys are provided, the update will be written to each of them.
1693+
Only works for collections with the `custom` sharding method.
1694+
key: Path to the nested field in the payload to modify. If not specified, modifies the root of the payload.
1695+
E.g.::
1696+
1697+
PointStruct(
1698+
id=42,
1699+
vector=[...],
1700+
payload={
1701+
"recipe": {
1702+
"fruits": {"apple": "100g"}
1703+
}
17111704
}
1712-
}
1713-
)
1714-
1715-
qdrant_client.set_payload(
1716-
...,
1717-
payload = {"cinnamon": "2g"},
1718-
key = "recipe.fruits",
1719-
points=[42]
1720-
)
1721-
1722-
PointStruct(
1723-
id=42,
1724-
vector=[...],
1725-
payload={
1726-
"recipe": {
1727-
"fruits": {
1728-
"apple": "100g",
1729-
"cinnamon": "2g"
1705+
)
1706+
1707+
qdrant_client.set_payload(
1708+
...,
1709+
payload={"cinnamon": "2g"},
1710+
key="recipe.fruits",
1711+
points=[42]
1712+
)
1713+
1714+
PointStruct(
1715+
id=42,
1716+
vector=[...],
1717+
payload={
1718+
"recipe": {
1719+
"fruits": {
1720+
"apple": "100g",
1721+
"cinnamon": "2g"
1722+
}
17301723
}
17311724
}
1732-
}
1733-
)
1725+
)
17341726
17351727
Returns:
1736-
Operation result
1728+
Operation result.
17371729
"""
17381730
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
17391731
return await self._client.set_payload(
@@ -1784,7 +1776,7 @@ async def overwrite_payload(
17841776
- If `false`, result will be returned immediately after the confirmation of receiving.
17851777
payload: Key-value pairs of payload to assign
17861778
points: List of affected points, filter or points selector.
1787-
Example
1779+
Example:
17881780
- `points=[1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90"]`
17891781
- `points=Filter(must=[FieldCondition(key='rand_number', range=Range(gte=0.7))])`
17901782
@@ -1833,7 +1825,7 @@ async def delete_payload(
18331825
- If `false`, result will be returned immediately after the confirmation of receiving.
18341826
keys: List of payload keys to remove
18351827
points: List of affected points, filter or points selector.
1836-
Example
1828+
Example:
18371829
- `points=[1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90"]`
18381830
- `points=Filter(must=[FieldCondition(key='rand_number', range=Range(gte=0.7))])`
18391831
ordering (Optional[WriteOrdering]): Define strategy for ordering of the points. Possible values:
@@ -1877,7 +1869,7 @@ async def clear_payload(
18771869
wait: Await for the results to be processed.
18781870
- If `true`, result will be returned only when all changes are applied
18791871
- If `false`, result will be returned immediately after the confirmation of receiving.
1880-
points_selector: List of affected points, filter or points selector. Example
1872+
points_selector: List of affected points, filter or points selector. Example:
18811873
- `points=[1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90"]`
18821874
- `points=Filter(must=[FieldCondition(key='rand_number', range=Range(gte=0.7))])`
18831875
ordering (Optional[WriteOrdering]): Define strategy for ordering of the points. Possible values:

qdrant_client/async_qdrant_fastembed.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ def set_model(
9494
) -> None:
9595
"""
9696
Set embedding model to use for encoding documents and queries.
97+
9798
Args:
9899
embedding_model_name: One of the supported embedding models. See `SUPPORTED_EMBEDDING_MODELS` for details.
99100
max_length (int, optional): Deprecated. Defaults to None.
100101
cache_dir (str, optional): The path to the cache directory.
101-
Can be set using the `FASTEMBED_CACHE_PATH` env variable.
102-
Defaults to `fastembed_cache` in the system's temp directory.
102+
Can be set using the `FASTEMBED_CACHE_PATH` env variable.
103+
Defaults to `fastembed_cache` in the system's temp directory.
103104
threads (int, optional): The number of threads single onnxruntime session can use. Defaults to None.
104105
providers: The list of onnx providers (with or without options) to use. Defaults to None.
105106
Example configuration:
@@ -136,6 +137,7 @@ def set_sparse_model(
136137
) -> None:
137138
"""
138139
Set sparse embedding model to use for hybrid search over documents in combination with dense embeddings.
140+
139141
Args:
140142
embedding_model_name: One of the supported sparse embedding models. See `SUPPORTED_SPARSE_EMBEDDING_MODELS` for details.
141143
If None, sparse embeddings will not be used.

0 commit comments

Comments
 (0)