diff --git a/setup.cfg b/setup.cfg index ecafea2..088736f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,7 @@ exclude = .git,__pycache__,venv,.eggs,*.egg,src/typesense/__init__.py ignore = Q000, WPS602, WPS432, WPS305, WPS221, WPS230, WPS234, WPS433, WPS440, W503, WPS331, WPS306, WPS237, WPS202, RST301, RST306, WPS214, WPS235, WPS226, WPS337, WPS320, F821, WPS201 per-file-ignores = tests/*.py: S101, WPS226, WPS118, WPS202, WPS204, WPS218, WPS211, WPS604, WPS431, WPS210, WPS201, WPS437 - src/typesense/types/*.py: B950, WPS215, WPS111, WPS462, WPS322, WPS428, WPS114, WPS110, WPS202 + src/typesense/types/*.py: B950, WPS215, WPS111, WPS462, WPS322, WPS428, WPS114, WPS110, WPS202, WPS115 src/typesense/documents.py: WPS320, E704, D102, WPS428, WPS220 src/typesense/stemming_dictionaries.py: WPS320, E704, D102, WPS428, WPS220 src/typesense/api_call.py: WPS110, WPS211 diff --git a/src/typesense/types/collection.py b/src/typesense/types/collection.py index e929fa6..9e8a397 100644 --- a/src/typesense/types/collection.py +++ b/src/typesense/types/collection.py @@ -36,6 +36,19 @@ Locales = typing.Literal["ja", "zh", "ko", "th", "el", "ru", "rs", "uk", "be", ""] +class HNSWParamsSchema(typing.TypedDict): + """ + The schema for the HNSW parameters in the CollectionFieldSchema. + + Attributes: + M (int): The number of bi-directional links created for every new element. + ef_construction (int): The size of the dynamic list for the nearest neighbors. + """ + + M: typing.NotRequired[int] + ef_construction: typing.NotRequired[int] + + class CollectionFieldSchema(typing.Generic[_TType], typing.TypedDict, total=False): """ CollectionFieldSchema represents the schema of a field in a collection. @@ -70,6 +83,7 @@ class CollectionFieldSchema(typing.Generic[_TType], typing.TypedDict, total=Fals symbols_to_index: typing.NotRequired[typing.List[str]] token_separators: typing.NotRequired[typing.List[str]] num_dim: typing.NotRequired[float] + hnsw_params: typing.NotRequired[HNSWParamsSchema] range_index: typing.NotRequired[bool] index: typing.NotRequired[bool] vec_dist: typing.NotRequired[typing.Union[typing.Literal["cosine", "ip"], str]]