Skip to content

Commit d43d820

Browse files
committed
feat(types): add hnsw parameters to field schema
1 parent 1208b64 commit d43d820

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/typesense/types/collection.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,22 @@ class CollectionFieldSchema(typing.Generic[_TType], typing.TypedDict, total=Fals
7070
symbols_to_index: typing.NotRequired[typing.List[str]]
7171
token_separators: typing.NotRequired[typing.List[str]]
7272
num_dim: typing.NotRequired[float]
73+
hnsw_params: typing.NotRequired[HNSWParamsSchema]
7374
range_index: typing.NotRequired[bool]
7475
index: typing.NotRequired[bool]
7576
vec_dist: typing.NotRequired[typing.Union[typing.Literal["cosine", "ip"], str]]
7677

78+
class HNSWParamsSchema(typing.TypedDict):
79+
"""
80+
The schema for the HNSW parameters in the CollectionFieldSchema.
81+
82+
Attributes:
83+
M (int): The number of bi-directional links created for every new element.
84+
ef_construction (int): The size of the dynamic list for the nearest neighbors.
85+
"""
86+
87+
M: typing.NotRequired[int]
88+
ef_construction: typing.NotRequired[int]
7789

7890
class RegularCollectionFieldSchema(CollectionFieldSchema[_FieldType]):
7991
"""

0 commit comments

Comments
 (0)