zvec 0.2.1b2.dev1__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. _zvec.cp310-win_amd64.pyd +0 -0
  2. gflags_nothreads.dll +0 -0
  3. glog.dll +0 -0
  4. lib/zvec_ailego.lib +0 -0
  5. lib/zvec_core.lib +0 -0
  6. lib/zvec_turbo.lib +0 -0
  7. libprotobuf.dll +0 -0
  8. roaring.dll +0 -0
  9. zvec/__init__.py +168 -0
  10. zvec/__init__.pyi +171 -0
  11. zvec/common/__init__.py +18 -0
  12. zvec/common/constants.py +33 -0
  13. zvec/executor/__init__.py +26 -0
  14. zvec/executor/query_executor.py +307 -0
  15. zvec/extension/__init__.py +55 -0
  16. zvec/extension/bm25_embedding_function.py +375 -0
  17. zvec/extension/embedding_function.py +147 -0
  18. zvec/extension/http_embedding_function.py +162 -0
  19. zvec/extension/jina_embedding_function.py +240 -0
  20. zvec/extension/jina_function.py +182 -0
  21. zvec/extension/multi_vector_reranker.py +174 -0
  22. zvec/extension/openai_embedding_function.py +238 -0
  23. zvec/extension/openai_function.py +149 -0
  24. zvec/extension/qwen_embedding_function.py +537 -0
  25. zvec/extension/qwen_function.py +186 -0
  26. zvec/extension/qwen_rerank_function.py +162 -0
  27. zvec/extension/rerank_function.py +69 -0
  28. zvec/extension/sentence_transformer_embedding_function.py +839 -0
  29. zvec/extension/sentence_transformer_function.py +150 -0
  30. zvec/extension/sentence_transformer_rerank_function.py +384 -0
  31. zvec/model/__init__.py +22 -0
  32. zvec/model/collection.py +411 -0
  33. zvec/model/convert.py +54 -0
  34. zvec/model/doc.py +173 -0
  35. zvec/model/param/__init__.py +46 -0
  36. zvec/model/param/__init__.pyi +823 -0
  37. zvec/model/param/vector_query.py +80 -0
  38. zvec/model/schema/__init__.py +21 -0
  39. zvec/model/schema/__init__.pyi +109 -0
  40. zvec/model/schema/collection_schema.py +215 -0
  41. zvec/model/schema/field_schema.py +300 -0
  42. zvec/py.typed +0 -0
  43. zvec/tool/__init__.py +18 -0
  44. zvec/tool/util.py +63 -0
  45. zvec/typing/__init__.py +32 -0
  46. zvec/typing/__init__.pyi +404 -0
  47. zvec/typing/enum.py +62 -0
  48. zvec/zvec.py +226 -0
  49. zvec-0.2.1b2.dev1.dist-info/METADATA +183 -0
  50. zvec-0.2.1b2.dev1.dist-info/RECORD +52 -0
  51. zvec-0.2.1b2.dev1.dist-info/WHEEL +5 -0
  52. zvec-0.2.1b2.dev1.dist-info/licenses/LICENSE +201 -0
Binary file
gflags_nothreads.dll ADDED
Binary file
glog.dll ADDED
Binary file
lib/zvec_ailego.lib ADDED
Binary file
lib/zvec_core.lib ADDED
Binary file
lib/zvec_turbo.lib ADDED
Binary file
libprotobuf.dll ADDED
Binary file
roaring.dll ADDED
Binary file
zvec/__init__.py ADDED
@@ -0,0 +1,168 @@
1
+ # Copyright 2025-present the zvec project
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from __future__ import annotations
16
+
17
+ import sys
18
+ from typing import TYPE_CHECKING
19
+
20
+ if TYPE_CHECKING:
21
+ from importlib.metadata import PackageNotFoundError
22
+
23
+
24
+ # ==============================
25
+ # Public API — grouped by category
26
+ # ==============================
27
+
28
+ from . import model as model
29
+
30
+ # —— Extensions ——
31
+ from .extension import (
32
+ BM25EmbeddingFunction,
33
+ DefaultLocalDenseEmbedding,
34
+ DefaultLocalReRanker,
35
+ DefaultLocalSparseEmbedding,
36
+ DenseEmbeddingFunction,
37
+ OpenAIDenseEmbedding,
38
+ OpenAIFunctionBase,
39
+ QwenDenseEmbedding,
40
+ QwenFunctionBase,
41
+ QwenReRanker,
42
+ QwenSparseEmbedding,
43
+ ReRanker,
44
+ RrfReRanker,
45
+ SentenceTransformerFunctionBase,
46
+ SparseEmbeddingFunction,
47
+ WeightedReRanker,
48
+ )
49
+
50
+ # —— Typing ——
51
+ from .model import param as param
52
+ from .model import schema as schema
53
+
54
+ # —— Core data structures ——
55
+ from .model.collection import Collection
56
+ from .model.doc import Doc
57
+
58
+ # —— Query & index parameters ——
59
+ from .model.param import (
60
+ AddColumnOption,
61
+ AlterColumnOption,
62
+ CollectionOption,
63
+ FlatIndexParam,
64
+ HnswIndexParam,
65
+ HnswQueryParam,
66
+ HnswRabitqIndexParam,
67
+ HnswRabitqQueryParam,
68
+ IndexOption,
69
+ InvertIndexParam,
70
+ IVFIndexParam,
71
+ IVFQueryParam,
72
+ OptimizeOption,
73
+ )
74
+ from .model.param.vector_query import VectorQuery
75
+
76
+ # —— Schema & field definitions ——
77
+ from .model.schema import CollectionSchema, CollectionStats, FieldSchema, VectorSchema
78
+
79
+ # —— tools ——
80
+ from .tool import require_module
81
+ from .typing import (
82
+ DataType,
83
+ IndexType,
84
+ MetricType,
85
+ QuantizeType,
86
+ Status,
87
+ StatusCode,
88
+ )
89
+ from .typing.enum import LogLevel, LogType
90
+
91
+ # —— lifecycle ——
92
+ from .zvec import create_and_open, init, open
93
+
94
+ # ==============================
95
+ # Public interface declaration
96
+ # ==============================
97
+ __all__ = [
98
+ # Zvec functions
99
+ "create_and_open",
100
+ "init",
101
+ "open",
102
+ # Core classes
103
+ "Collection",
104
+ "Doc",
105
+ # Schema
106
+ "CollectionSchema",
107
+ "FieldSchema",
108
+ "VectorSchema",
109
+ "CollectionStats",
110
+ # Parameters
111
+ "VectorQuery",
112
+ "InvertIndexParam",
113
+ "HnswIndexParam",
114
+ "HnswRabitqIndexParam",
115
+ "HnswRabitqQueryParam",
116
+ "FlatIndexParam",
117
+ "IVFIndexParam",
118
+ "CollectionOption",
119
+ "IndexOption",
120
+ "OptimizeOption",
121
+ "AddColumnOption",
122
+ "AlterColumnOption",
123
+ "HnswQueryParam",
124
+ "IVFQueryParam",
125
+ # Extensions
126
+ "DenseEmbeddingFunction",
127
+ "SparseEmbeddingFunction",
128
+ "QwenFunctionBase",
129
+ "OpenAIFunctionBase",
130
+ "SentenceTransformerFunctionBase",
131
+ "ReRanker",
132
+ "DefaultLocalDenseEmbedding",
133
+ "DefaultLocalSparseEmbedding",
134
+ "BM25EmbeddingFunction",
135
+ "OpenAIDenseEmbedding",
136
+ "QwenDenseEmbedding",
137
+ "QwenSparseEmbedding",
138
+ "RrfReRanker",
139
+ "WeightedReRanker",
140
+ "DefaultLocalReRanker",
141
+ "QwenReRanker",
142
+ # Typing
143
+ "DataType",
144
+ "MetricType",
145
+ "QuantizeType",
146
+ "IndexType",
147
+ "LogLevel",
148
+ "LogType",
149
+ "Status",
150
+ "StatusCode",
151
+ # Tools
152
+ "require_module",
153
+ ]
154
+
155
+ # ==============================
156
+ # Version handling
157
+ # ==============================
158
+ __version__: str
159
+
160
+ try:
161
+ from importlib.metadata import version
162
+ except ImportError:
163
+ from importlib_metadata import version # Python < 3.8
164
+
165
+ try:
166
+ __version__ = version("zvec")
167
+ except Exception:
168
+ __version__ = "unknown"
zvec/__init__.pyi ADDED
@@ -0,0 +1,171 @@
1
+ """
2
+ Zvec core module
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import collections
8
+
9
+ from . import typing
10
+ from .extension import ReRanker, RrfReRanker, WeightedReRanker
11
+ from .extension.embedding import DenseEmbeddingFunction
12
+ from .model import param, schema
13
+ from .model.collection import Collection
14
+ from .model.doc import Doc
15
+ from .model.param import (
16
+ AddColumnOption,
17
+ AlterColumnOption,
18
+ CollectionOption,
19
+ FlatIndexParam,
20
+ HnswIndexParam,
21
+ HnswQueryParam,
22
+ IndexOption,
23
+ InvertIndexParam,
24
+ IVFIndexParam,
25
+ IVFQueryParam,
26
+ OptimizeOption,
27
+ )
28
+ from .model.param.vector_query import VectorQuery
29
+ from .model.schema import CollectionSchema, CollectionStats, FieldSchema, VectorSchema
30
+ from .tool import require_module
31
+ from .typing import (
32
+ DataType,
33
+ IndexType,
34
+ MetricType,
35
+ QuantizeType,
36
+ Status,
37
+ StatusCode,
38
+ )
39
+ from .typing.enum import LogLevel, LogType
40
+ from .zvec import create_and_open, init, open
41
+
42
+ __all__: list = [
43
+ "AddColumnOption",
44
+ "AlterColumnOption",
45
+ "Collection",
46
+ "CollectionOption",
47
+ "CollectionSchema",
48
+ "CollectionStats",
49
+ "DataType",
50
+ "DenseEmbeddingFunction",
51
+ "DenseEmbeddingFunction",
52
+ "Doc",
53
+ "FieldSchema",
54
+ "FlatIndexParam",
55
+ "HnswIndexParam",
56
+ "HnswQueryParam",
57
+ "IVFIndexParam",
58
+ "IVFQueryParam",
59
+ "IndexOption",
60
+ "IndexType",
61
+ "InvertIndexParam",
62
+ "LogLevel",
63
+ "LogType",
64
+ "MetricType",
65
+ "OptimizeOption",
66
+ "QuantizeType",
67
+ "ReRanker",
68
+ "ReRanker",
69
+ "RrfReRanker",
70
+ "Status",
71
+ "StatusCode",
72
+ "VectorQuery",
73
+ "VectorSchema",
74
+ "WeightedReRanker",
75
+ "create_and_open",
76
+ "init",
77
+ "open",
78
+ "require_module",
79
+ ]
80
+
81
+ class _Collection:
82
+ @staticmethod
83
+ def CreateAndOpen(
84
+ arg0: str, arg1: schema._CollectionSchema, arg2: param.CollectionOption
85
+ ) -> _Collection: ...
86
+ @staticmethod
87
+ def Open(arg0: str, arg1: param.CollectionOption) -> _Collection: ...
88
+ def AddColumn(
89
+ self,
90
+ arg0: schema._FieldSchema,
91
+ arg1: str,
92
+ arg2: param.AddColumnOption,
93
+ ) -> None: ...
94
+ def AlterColumn(
95
+ self,
96
+ arg0: str,
97
+ arg1: str,
98
+ arg2: schema._FieldSchema,
99
+ arg3: param.AlterColumnOption,
100
+ ) -> None: ...
101
+ def CreateIndex(
102
+ self, arg0: str, arg1: param.IndexParam, arg2: param.IndexOption
103
+ ) -> None: ...
104
+ def Delete(self, arg0: collections.abc.Sequence[str]) -> list[typing.Status]: ...
105
+ def DeleteByFilter(self, arg0: str) -> None: ...
106
+ def Destroy(self) -> None: ...
107
+ def DropColumn(self, arg0: str) -> None: ...
108
+ def DropIndex(self, arg0: str) -> None: ...
109
+ def Fetch(self, arg0: collections.abc.Sequence[str]) -> dict[str, _Doc]: ...
110
+ def Flush(self) -> None: ...
111
+ def GroupByQuery(self, arg0: ...) -> list[...]: ...
112
+ def Insert(self, arg0: collections.abc.Sequence[_Doc]) -> list[typing.Status]: ...
113
+ def Optimize(self, arg0: param.OptimizeOption) -> None: ...
114
+ def Options(self) -> param.CollectionOption: ...
115
+ def Path(self) -> str: ...
116
+ def Query(self, arg0: param._VectorQuery) -> list[_Doc]: ...
117
+ def Schema(self) -> schema._CollectionSchema: ...
118
+ def Stats(self) -> schema.CollectionStats: ...
119
+ def Update(self, arg0: collections.abc.Sequence[_Doc]) -> list[typing.Status]: ...
120
+ def Upsert(self, arg0: collections.abc.Sequence[_Doc]) -> list[typing.Status]: ...
121
+ def __getstate__(self) -> tuple: ...
122
+ def __setstate__(self, arg0: tuple) -> None: ...
123
+
124
+ class _Doc:
125
+ def __getstate__(self) -> bytes: ...
126
+ def __init__(self) -> None: ...
127
+ def __setstate__(self, arg0: bytes) -> None: ...
128
+ def field_names(self) -> list[str]: ...
129
+ def get_any(self, arg0: str, arg1: typing.DataType) -> typing.Any: ...
130
+ def has_field(self, arg0: str) -> bool: ...
131
+ def pk(self) -> str: ...
132
+ def score(self) -> float: ...
133
+ def set_any(self, arg0: str, arg1: typing.DataType, arg2: typing.Any) -> bool: ...
134
+ def set_pk(self, arg0: str) -> None: ...
135
+ def set_score(self, arg0: typing.SupportsFloat) -> None: ...
136
+
137
+ class _DocOp:
138
+ """
139
+ Members:
140
+
141
+ INSERT
142
+
143
+ UPDATE
144
+
145
+ DELETE
146
+
147
+ UPSERT
148
+ """
149
+
150
+ DELETE: typing.ClassVar[_DocOp] # value = <_DocOp.DELETE: 3>
151
+ INSERT: typing.ClassVar[_DocOp] # value = <_DocOp.INSERT: 0>
152
+ UPDATE: typing.ClassVar[_DocOp] # value = <_DocOp.UPDATE: 2>
153
+ UPSERT: typing.ClassVar[_DocOp] # value = <_DocOp.UPSERT: 1>
154
+ __members__: typing.ClassVar[
155
+ dict[str, _DocOp]
156
+ ] # value = {'INSERT': <_DocOp.INSERT: 0>, 'UPDATE': <_DocOp.UPDATE: 2>, 'DELETE': <_DocOp.DELETE: 3>, 'UPSERT': <_DocOp.UPSERT: 1>}
157
+
158
+ def __eq__(self, other: typing.Any) -> bool: ...
159
+ def __getstate__(self) -> int: ...
160
+ def __hash__(self) -> int: ...
161
+ def __index__(self) -> int: ...
162
+ def __init__(self, value: typing.SupportsInt) -> None: ...
163
+ def __int__(self) -> int: ...
164
+ def __ne__(self, other: typing.Any) -> bool: ...
165
+ def __repr__(self) -> str: ...
166
+ def __setstate__(self, state: typing.SupportsInt) -> None: ...
167
+ def __str__(self) -> str: ...
168
+ @property
169
+ def name(self) -> str: ...
170
+ @property
171
+ def value(self) -> int: ...
@@ -0,0 +1,18 @@
1
+ # Copyright 2025-present the zvec project
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from __future__ import annotations
15
+
16
+ from .constants import DenseVectorType, SparseVectorType, VectorType
17
+
18
+ __all__ = ["DenseVectorType", "SparseVectorType", "VectorType"]
@@ -0,0 +1,33 @@
1
+ # Copyright 2025-present the zvec project
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from __future__ import annotations
15
+
16
+ from typing import Optional, TypeVar, Union
17
+
18
+ import numpy as np
19
+
20
+ # VectorType: DenseVectorType | SparseVectorType
21
+ DenseVectorType = Union[list[float], list[int], np.ndarray]
22
+ SparseVectorType = dict[int, float]
23
+ VectorType = Optional[Union[DenseVectorType, SparseVectorType]]
24
+
25
+ # Embeddable: Text | Image | Audio
26
+ TEXT = str
27
+ IMAGE = Union[str, bytes, np.ndarray] # file path, raw bytes, or numpy array
28
+ AUDIO = Union[str, bytes, np.ndarray] # file path, raw bytes, or numpy array
29
+
30
+ Embeddable = Optional[Union[TEXT, IMAGE, AUDIO]]
31
+
32
+ # Multimodal Embeddable
33
+ MD = TypeVar("MD", bound=Embeddable, contravariant=True)
@@ -0,0 +1,26 @@
1
+ # Copyright 2025-present the zvec project
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from __future__ import annotations
15
+
16
+ from .query_executor import (
17
+ QueryContext,
18
+ QueryExecutor,
19
+ QueryExecutorFactory,
20
+ )
21
+
22
+ __all__ = [
23
+ "QueryContext",
24
+ "QueryExecutor",
25
+ "QueryExecutorFactory",
26
+ ]