vectorizer-sdk 1.0.1__tar.gz → 1.3.0__tar.gz

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 (28) hide show
  1. vectorizer_sdk-1.3.0/LICENSE +191 -0
  2. {vectorizer_sdk-1.0.1/vectorizer_sdk.egg-info → vectorizer_sdk-1.3.0}/PKG-INFO +74 -23
  3. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/README.md +73 -22
  4. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/pyproject.toml +2 -2
  5. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_client_integration.py +0 -0
  6. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_discovery.py +0 -0
  7. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_exceptions.py +0 -0
  8. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_file_operations.py +0 -0
  9. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_http_client.py +0 -0
  10. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_intelligent_search.py +0 -0
  11. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_models.py +0 -0
  12. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_sdk_comprehensive.py +0 -0
  13. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_simple.py +0 -0
  14. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_umicp.py +0 -0
  15. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/tests/test_validation.py +0 -0
  16. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/utils/__init__.py +0 -0
  17. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/utils/http_client.py +0 -0
  18. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/utils/transport.py +0 -0
  19. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/utils/umicp_client.py +0 -0
  20. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/utils/validation.py +0 -0
  21. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0/vectorizer_sdk.egg-info}/PKG-INFO +74 -23
  22. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/top_level.txt +1 -0
  23. vectorizer_sdk-1.0.1/LICENSE +0 -21
  24. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/setup.cfg +0 -0
  25. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/SOURCES.txt +0 -0
  26. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/dependency_links.txt +0 -0
  27. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/entry_points.txt +0 -0
  28. {vectorizer_sdk-1.0.1 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/requires.txt +0 -0
@@ -0,0 +1,191 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work (which
38
+ shall not include Communications that are clearly marked or
39
+ otherwise designated in writing by the copyright owner as "Not a Work").
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and do
118
+ not modify the License. You may add Your own attribution notices
119
+ within Derivative Works that You distribute, alongside or as an
120
+ addendum to the NOTICE text from the Work, provided that such
121
+ additional attribution notices cannot be construed as modifying
122
+ the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions for
126
+ use, reproduction, or distribution of Your modifications, or for any
127
+ such Derivative Works as a whole, provided Your use, reproduction,
128
+ and distribution of the Work otherwise complies with the conditions
129
+ stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2024 HiveLLM Contributors
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vectorizer_sdk
3
- Version: 1.0.1
3
+ Version: 1.3.0
4
4
  Summary: Python SDK for Vectorizer - Semantic search and vector operations with UMICP protocol support
5
5
  Author-email: HiveLLM Team <team@hivellm.org>
6
- License-Expression: MIT
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Homepage, https://github.com/hivellm/vectorizer
8
8
  Project-URL: Documentation, https://github.com/hivellm/vectorizer/tree/main/docs
9
9
  Project-URL: Repository, https://github.com/hivellm/vectorizer
@@ -47,20 +47,30 @@ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
47
47
  Requires-Dist: httpx>=0.24.0; extra == "test"
48
48
  Dynamic: license-file
49
49
 
50
- # Hive Vectorizer Python SDK
50
+ # Vectorizer Python SDK
51
51
 
52
- A comprehensive Python client library for the Hive Vectorizer service.
52
+ [![PyPI version](https://badge.fury.io/py/vectorizer-sdk.svg)](https://pypi.org/project/vectorizer-sdk/)
53
+ [![Python Versions](https://img.shields.io/pypi/pyversions/vectorizer-sdk.svg)](https://pypi.org/project/vectorizer-sdk/)
54
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
55
+
56
+ A comprehensive Python SDK for the Vectorizer semantic search service.
57
+
58
+ **Package**: `vectorizer_sdk` (PEP 625 compliant)
59
+ **Version**: 1.3.0
60
+ **PyPI**: https://pypi.org/project/vectorizer-sdk/
53
61
 
54
62
  ## Features
55
63
 
56
64
  - **Multiple Transport Protocols**: HTTP/HTTPS and UMICP support
57
- - **UMICP Protocol**: High-performance protocol using umicp-python package
65
+ - **UMICP Protocol**: High-performance protocol using umicp-sdk package (v0.3.2+)
58
66
  - **Vector Operations**: Insert, search, and manage vectors
59
- - **Collection Management**: Create, delete, and monitor collections
67
+ - **Collection Management**: Create, delete, and monitor collections
60
68
  - **Semantic Search**: Find similar content using embeddings
61
69
  - **Intelligent Search**: Advanced multi-query search with domain expansion
62
70
  - **Contextual Search**: Context-aware search with metadata filtering
63
71
  - **Multi-Collection Search**: Cross-collection search with intelligent aggregation
72
+ - **Hybrid Search**: Combine dense and sparse vectors for improved search quality
73
+ - **Qdrant Compatibility**: Full Qdrant REST API compatibility for easy migration
64
74
  - **Batch Operations**: Efficient bulk operations
65
75
  - **Error Handling**: Comprehensive exception handling
66
76
  - **Async Support**: Full async/await support for high performance
@@ -69,7 +79,11 @@ A comprehensive Python client library for the Hive Vectorizer service.
69
79
  ## Installation
70
80
 
71
81
  ```bash
82
+ # Install from PyPI
72
83
  pip install vectorizer-sdk
84
+
85
+ # Or specific version
86
+ pip install vectorizer-sdk==1.3.0
73
87
  ```
74
88
 
75
89
  ## Quick Start
@@ -82,31 +96,31 @@ async def main():
82
96
  async with VectorizerClient() as client:
83
97
  # Create a collection
84
98
  await client.create_collection("my_collection", dimension=512)
85
-
99
+
86
100
  # Generate embedding
87
101
  embedding = await client.embed_text("Hello, world!")
88
-
102
+
89
103
  # Create vector
90
104
  vector = Vector(
91
105
  id="doc1",
92
106
  data=embedding,
93
107
  metadata={"text": "Hello, world!"}
94
108
  )
95
-
109
+
96
110
  # Insert text
97
111
  await client.insert_texts("my_collection", [{
98
112
  "id": "doc1",
99
113
  "text": "Hello, world!",
100
114
  "metadata": {"source": "example"}
101
115
  }])
102
-
116
+
103
117
  # Search for similar vectors
104
118
  results = await client.search_vectors(
105
119
  collection="my_collection",
106
120
  query="greeting",
107
121
  limit=5
108
122
  )
109
-
123
+
110
124
  # Intelligent search with multi-query expansion
111
125
  from models import IntelligentSearchRequest
112
126
  intelligent_results = await client.intelligent_search(
@@ -120,7 +134,7 @@ async def main():
120
134
  mmr_lambda=0.7
121
135
  )
122
136
  )
123
-
137
+
124
138
  # Semantic search with reranking
125
139
  from models import SemanticSearchRequest
126
140
  semantic_results = await client.semantic_search(
@@ -132,7 +146,7 @@ async def main():
132
146
  similarity_threshold=0.6
133
147
  )
134
148
  )
135
-
149
+
136
150
  # Contextual search with metadata filtering
137
151
  from models import ContextualSearchRequest
138
152
  contextual_results = await client.contextual_search(
@@ -144,7 +158,7 @@ async def main():
144
158
  context_weight=0.4
145
159
  )
146
160
  )
147
-
161
+
148
162
  # Multi-collection search
149
163
  from models import MultiCollectionSearchRequest
150
164
  multi_results = await client.multi_collection_search(
@@ -156,8 +170,43 @@ async def main():
156
170
  cross_collection_reranking=True
157
171
  )
158
172
  )
159
-
160
- print(f"Found {len(results)} similar vectors")
173
+
174
+ # Hybrid search (dense + sparse vectors)
175
+ from models import HybridSearchRequest, SparseVector
176
+
177
+ sparse_query = SparseVector(
178
+ indices=[0, 5, 10, 15],
179
+ values=[0.8, 0.6, 0.9, 0.7]
180
+ )
181
+
182
+ hybrid_results = await client.hybrid_search(
183
+ HybridSearchRequest(
184
+ collection="my_collection",
185
+ query="search query",
186
+ query_sparse=sparse_query,
187
+ alpha=0.7,
188
+ algorithm="rrf", # "rrf", "weighted", or "alpha"
189
+ dense_k=20,
190
+ sparse_k=20,
191
+ final_k=10
192
+ )
193
+ )
194
+
195
+ print(f"Found {len(hybrid_results.results)} similar vectors")
196
+
197
+ # Qdrant-compatible API usage
198
+ # List collections
199
+ qdrant_collections = await client.qdrant_list_collections()
200
+ print(f"Qdrant collections: {qdrant_collections}")
201
+
202
+ # Search points (Qdrant format)
203
+ qdrant_results = await client.qdrant_search_points(
204
+ collection="my_collection",
205
+ vector=embedding,
206
+ limit=10,
207
+ with_payload=True
208
+ )
209
+ print(f"Qdrant search results: {qdrant_results}")
161
210
 
162
211
  asyncio.run(main())
163
212
  ```
@@ -213,24 +262,26 @@ client = VectorizerClient(
213
262
  #### When to Use UMICP
214
263
 
215
264
  Use UMICP when:
265
+
216
266
  - **Large Payloads**: Inserting or searching large batches of vectors
217
267
  - **High Throughput**: Need maximum performance for production workloads
218
268
  - **Low Latency**: Need minimal protocol overhead
219
269
 
220
270
  Use HTTP when:
271
+
221
272
  - **Development**: Quick testing and debugging
222
273
  - **Firewall Restrictions**: Only HTTP/HTTPS allowed
223
274
  - **Simple Deployments**: No need for custom protocol setup
224
275
 
225
276
  #### Protocol Comparison
226
277
 
227
- | Feature | HTTP/HTTPS | UMICP |
228
- |---------|-----------|-------|
229
- | Transport | aiohttp (standard HTTP) | umicp-python package |
230
- | Performance | Standard | Optimized for large payloads |
231
- | Latency | Standard | Lower overhead |
232
- | Firewall | Widely supported | May require configuration |
233
- | Installation | Default | Requires umicp-python |
278
+ | Feature | HTTP/HTTPS | UMICP |
279
+ | ------------ | ----------------------- | ---------------------------- |
280
+ | Transport | aiohttp (standard HTTP) | umicp-python package |
281
+ | Performance | Standard | Optimized for large payloads |
282
+ | Latency | Standard | Lower overhead |
283
+ | Firewall | Widely supported | May require configuration |
284
+ | Installation | Default | Requires umicp-python |
234
285
 
235
286
  #### Installing with UMICP Support
236
287
 
@@ -1,17 +1,27 @@
1
- # Hive Vectorizer Python SDK
1
+ # Vectorizer Python SDK
2
2
 
3
- A comprehensive Python client library for the Hive Vectorizer service.
3
+ [![PyPI version](https://badge.fury.io/py/vectorizer-sdk.svg)](https://pypi.org/project/vectorizer-sdk/)
4
+ [![Python Versions](https://img.shields.io/pypi/pyversions/vectorizer-sdk.svg)](https://pypi.org/project/vectorizer-sdk/)
5
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
6
+
7
+ A comprehensive Python SDK for the Vectorizer semantic search service.
8
+
9
+ **Package**: `vectorizer_sdk` (PEP 625 compliant)
10
+ **Version**: 1.3.0
11
+ **PyPI**: https://pypi.org/project/vectorizer-sdk/
4
12
 
5
13
  ## Features
6
14
 
7
15
  - **Multiple Transport Protocols**: HTTP/HTTPS and UMICP support
8
- - **UMICP Protocol**: High-performance protocol using umicp-python package
16
+ - **UMICP Protocol**: High-performance protocol using umicp-sdk package (v0.3.2+)
9
17
  - **Vector Operations**: Insert, search, and manage vectors
10
- - **Collection Management**: Create, delete, and monitor collections
18
+ - **Collection Management**: Create, delete, and monitor collections
11
19
  - **Semantic Search**: Find similar content using embeddings
12
20
  - **Intelligent Search**: Advanced multi-query search with domain expansion
13
21
  - **Contextual Search**: Context-aware search with metadata filtering
14
22
  - **Multi-Collection Search**: Cross-collection search with intelligent aggregation
23
+ - **Hybrid Search**: Combine dense and sparse vectors for improved search quality
24
+ - **Qdrant Compatibility**: Full Qdrant REST API compatibility for easy migration
15
25
  - **Batch Operations**: Efficient bulk operations
16
26
  - **Error Handling**: Comprehensive exception handling
17
27
  - **Async Support**: Full async/await support for high performance
@@ -20,7 +30,11 @@ A comprehensive Python client library for the Hive Vectorizer service.
20
30
  ## Installation
21
31
 
22
32
  ```bash
33
+ # Install from PyPI
23
34
  pip install vectorizer-sdk
35
+
36
+ # Or specific version
37
+ pip install vectorizer-sdk==1.3.0
24
38
  ```
25
39
 
26
40
  ## Quick Start
@@ -33,31 +47,31 @@ async def main():
33
47
  async with VectorizerClient() as client:
34
48
  # Create a collection
35
49
  await client.create_collection("my_collection", dimension=512)
36
-
50
+
37
51
  # Generate embedding
38
52
  embedding = await client.embed_text("Hello, world!")
39
-
53
+
40
54
  # Create vector
41
55
  vector = Vector(
42
56
  id="doc1",
43
57
  data=embedding,
44
58
  metadata={"text": "Hello, world!"}
45
59
  )
46
-
60
+
47
61
  # Insert text
48
62
  await client.insert_texts("my_collection", [{
49
63
  "id": "doc1",
50
64
  "text": "Hello, world!",
51
65
  "metadata": {"source": "example"}
52
66
  }])
53
-
67
+
54
68
  # Search for similar vectors
55
69
  results = await client.search_vectors(
56
70
  collection="my_collection",
57
71
  query="greeting",
58
72
  limit=5
59
73
  )
60
-
74
+
61
75
  # Intelligent search with multi-query expansion
62
76
  from models import IntelligentSearchRequest
63
77
  intelligent_results = await client.intelligent_search(
@@ -71,7 +85,7 @@ async def main():
71
85
  mmr_lambda=0.7
72
86
  )
73
87
  )
74
-
88
+
75
89
  # Semantic search with reranking
76
90
  from models import SemanticSearchRequest
77
91
  semantic_results = await client.semantic_search(
@@ -83,7 +97,7 @@ async def main():
83
97
  similarity_threshold=0.6
84
98
  )
85
99
  )
86
-
100
+
87
101
  # Contextual search with metadata filtering
88
102
  from models import ContextualSearchRequest
89
103
  contextual_results = await client.contextual_search(
@@ -95,7 +109,7 @@ async def main():
95
109
  context_weight=0.4
96
110
  )
97
111
  )
98
-
112
+
99
113
  # Multi-collection search
100
114
  from models import MultiCollectionSearchRequest
101
115
  multi_results = await client.multi_collection_search(
@@ -107,8 +121,43 @@ async def main():
107
121
  cross_collection_reranking=True
108
122
  )
109
123
  )
110
-
111
- print(f"Found {len(results)} similar vectors")
124
+
125
+ # Hybrid search (dense + sparse vectors)
126
+ from models import HybridSearchRequest, SparseVector
127
+
128
+ sparse_query = SparseVector(
129
+ indices=[0, 5, 10, 15],
130
+ values=[0.8, 0.6, 0.9, 0.7]
131
+ )
132
+
133
+ hybrid_results = await client.hybrid_search(
134
+ HybridSearchRequest(
135
+ collection="my_collection",
136
+ query="search query",
137
+ query_sparse=sparse_query,
138
+ alpha=0.7,
139
+ algorithm="rrf", # "rrf", "weighted", or "alpha"
140
+ dense_k=20,
141
+ sparse_k=20,
142
+ final_k=10
143
+ )
144
+ )
145
+
146
+ print(f"Found {len(hybrid_results.results)} similar vectors")
147
+
148
+ # Qdrant-compatible API usage
149
+ # List collections
150
+ qdrant_collections = await client.qdrant_list_collections()
151
+ print(f"Qdrant collections: {qdrant_collections}")
152
+
153
+ # Search points (Qdrant format)
154
+ qdrant_results = await client.qdrant_search_points(
155
+ collection="my_collection",
156
+ vector=embedding,
157
+ limit=10,
158
+ with_payload=True
159
+ )
160
+ print(f"Qdrant search results: {qdrant_results}")
112
161
 
113
162
  asyncio.run(main())
114
163
  ```
@@ -164,24 +213,26 @@ client = VectorizerClient(
164
213
  #### When to Use UMICP
165
214
 
166
215
  Use UMICP when:
216
+
167
217
  - **Large Payloads**: Inserting or searching large batches of vectors
168
218
  - **High Throughput**: Need maximum performance for production workloads
169
219
  - **Low Latency**: Need minimal protocol overhead
170
220
 
171
221
  Use HTTP when:
222
+
172
223
  - **Development**: Quick testing and debugging
173
224
  - **Firewall Restrictions**: Only HTTP/HTTPS allowed
174
225
  - **Simple Deployments**: No need for custom protocol setup
175
226
 
176
227
  #### Protocol Comparison
177
228
 
178
- | Feature | HTTP/HTTPS | UMICP |
179
- |---------|-----------|-------|
180
- | Transport | aiohttp (standard HTTP) | umicp-python package |
181
- | Performance | Standard | Optimized for large payloads |
182
- | Latency | Standard | Lower overhead |
183
- | Firewall | Widely supported | May require configuration |
184
- | Installation | Default | Requires umicp-python |
229
+ | Feature | HTTP/HTTPS | UMICP |
230
+ | ------------ | ----------------------- | ---------------------------- |
231
+ | Transport | aiohttp (standard HTTP) | umicp-python package |
232
+ | Performance | Standard | Optimized for large payloads |
233
+ | Latency | Standard | Lower overhead |
234
+ | Firewall | Widely supported | May require configuration |
235
+ | Installation | Default | Requires umicp-python |
185
236
 
186
237
  #### Installing with UMICP Support
187
238
 
@@ -252,4 +303,4 @@ MIT License - see LICENSE file for details.
252
303
  ## Support
253
304
 
254
305
  - GitHub Issues: https://github.com/cmmv-hive/vectorizer/issues
255
- - Email: team@hivellm.org
306
+ - Email: team@hivellm.org
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vectorizer_sdk"
7
- version = "1.0.1"
7
+ version = "1.3.0"
8
8
  description = "Python SDK for Vectorizer - Semantic search and vector operations with UMICP protocol support"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
11
- license = "MIT"
11
+ license = "Apache-2.0"
12
12
  authors = [
13
13
  {name = "HiveLLM Team", email = "team@hivellm.org"}
14
14
  ]
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vectorizer_sdk
3
- Version: 1.0.1
3
+ Version: 1.3.0
4
4
  Summary: Python SDK for Vectorizer - Semantic search and vector operations with UMICP protocol support
5
5
  Author-email: HiveLLM Team <team@hivellm.org>
6
- License-Expression: MIT
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Homepage, https://github.com/hivellm/vectorizer
8
8
  Project-URL: Documentation, https://github.com/hivellm/vectorizer/tree/main/docs
9
9
  Project-URL: Repository, https://github.com/hivellm/vectorizer
@@ -47,20 +47,30 @@ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
47
47
  Requires-Dist: httpx>=0.24.0; extra == "test"
48
48
  Dynamic: license-file
49
49
 
50
- # Hive Vectorizer Python SDK
50
+ # Vectorizer Python SDK
51
51
 
52
- A comprehensive Python client library for the Hive Vectorizer service.
52
+ [![PyPI version](https://badge.fury.io/py/vectorizer-sdk.svg)](https://pypi.org/project/vectorizer-sdk/)
53
+ [![Python Versions](https://img.shields.io/pypi/pyversions/vectorizer-sdk.svg)](https://pypi.org/project/vectorizer-sdk/)
54
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
55
+
56
+ A comprehensive Python SDK for the Vectorizer semantic search service.
57
+
58
+ **Package**: `vectorizer_sdk` (PEP 625 compliant)
59
+ **Version**: 1.3.0
60
+ **PyPI**: https://pypi.org/project/vectorizer-sdk/
53
61
 
54
62
  ## Features
55
63
 
56
64
  - **Multiple Transport Protocols**: HTTP/HTTPS and UMICP support
57
- - **UMICP Protocol**: High-performance protocol using umicp-python package
65
+ - **UMICP Protocol**: High-performance protocol using umicp-sdk package (v0.3.2+)
58
66
  - **Vector Operations**: Insert, search, and manage vectors
59
- - **Collection Management**: Create, delete, and monitor collections
67
+ - **Collection Management**: Create, delete, and monitor collections
60
68
  - **Semantic Search**: Find similar content using embeddings
61
69
  - **Intelligent Search**: Advanced multi-query search with domain expansion
62
70
  - **Contextual Search**: Context-aware search with metadata filtering
63
71
  - **Multi-Collection Search**: Cross-collection search with intelligent aggregation
72
+ - **Hybrid Search**: Combine dense and sparse vectors for improved search quality
73
+ - **Qdrant Compatibility**: Full Qdrant REST API compatibility for easy migration
64
74
  - **Batch Operations**: Efficient bulk operations
65
75
  - **Error Handling**: Comprehensive exception handling
66
76
  - **Async Support**: Full async/await support for high performance
@@ -69,7 +79,11 @@ A comprehensive Python client library for the Hive Vectorizer service.
69
79
  ## Installation
70
80
 
71
81
  ```bash
82
+ # Install from PyPI
72
83
  pip install vectorizer-sdk
84
+
85
+ # Or specific version
86
+ pip install vectorizer-sdk==1.3.0
73
87
  ```
74
88
 
75
89
  ## Quick Start
@@ -82,31 +96,31 @@ async def main():
82
96
  async with VectorizerClient() as client:
83
97
  # Create a collection
84
98
  await client.create_collection("my_collection", dimension=512)
85
-
99
+
86
100
  # Generate embedding
87
101
  embedding = await client.embed_text("Hello, world!")
88
-
102
+
89
103
  # Create vector
90
104
  vector = Vector(
91
105
  id="doc1",
92
106
  data=embedding,
93
107
  metadata={"text": "Hello, world!"}
94
108
  )
95
-
109
+
96
110
  # Insert text
97
111
  await client.insert_texts("my_collection", [{
98
112
  "id": "doc1",
99
113
  "text": "Hello, world!",
100
114
  "metadata": {"source": "example"}
101
115
  }])
102
-
116
+
103
117
  # Search for similar vectors
104
118
  results = await client.search_vectors(
105
119
  collection="my_collection",
106
120
  query="greeting",
107
121
  limit=5
108
122
  )
109
-
123
+
110
124
  # Intelligent search with multi-query expansion
111
125
  from models import IntelligentSearchRequest
112
126
  intelligent_results = await client.intelligent_search(
@@ -120,7 +134,7 @@ async def main():
120
134
  mmr_lambda=0.7
121
135
  )
122
136
  )
123
-
137
+
124
138
  # Semantic search with reranking
125
139
  from models import SemanticSearchRequest
126
140
  semantic_results = await client.semantic_search(
@@ -132,7 +146,7 @@ async def main():
132
146
  similarity_threshold=0.6
133
147
  )
134
148
  )
135
-
149
+
136
150
  # Contextual search with metadata filtering
137
151
  from models import ContextualSearchRequest
138
152
  contextual_results = await client.contextual_search(
@@ -144,7 +158,7 @@ async def main():
144
158
  context_weight=0.4
145
159
  )
146
160
  )
147
-
161
+
148
162
  # Multi-collection search
149
163
  from models import MultiCollectionSearchRequest
150
164
  multi_results = await client.multi_collection_search(
@@ -156,8 +170,43 @@ async def main():
156
170
  cross_collection_reranking=True
157
171
  )
158
172
  )
159
-
160
- print(f"Found {len(results)} similar vectors")
173
+
174
+ # Hybrid search (dense + sparse vectors)
175
+ from models import HybridSearchRequest, SparseVector
176
+
177
+ sparse_query = SparseVector(
178
+ indices=[0, 5, 10, 15],
179
+ values=[0.8, 0.6, 0.9, 0.7]
180
+ )
181
+
182
+ hybrid_results = await client.hybrid_search(
183
+ HybridSearchRequest(
184
+ collection="my_collection",
185
+ query="search query",
186
+ query_sparse=sparse_query,
187
+ alpha=0.7,
188
+ algorithm="rrf", # "rrf", "weighted", or "alpha"
189
+ dense_k=20,
190
+ sparse_k=20,
191
+ final_k=10
192
+ )
193
+ )
194
+
195
+ print(f"Found {len(hybrid_results.results)} similar vectors")
196
+
197
+ # Qdrant-compatible API usage
198
+ # List collections
199
+ qdrant_collections = await client.qdrant_list_collections()
200
+ print(f"Qdrant collections: {qdrant_collections}")
201
+
202
+ # Search points (Qdrant format)
203
+ qdrant_results = await client.qdrant_search_points(
204
+ collection="my_collection",
205
+ vector=embedding,
206
+ limit=10,
207
+ with_payload=True
208
+ )
209
+ print(f"Qdrant search results: {qdrant_results}")
161
210
 
162
211
  asyncio.run(main())
163
212
  ```
@@ -213,24 +262,26 @@ client = VectorizerClient(
213
262
  #### When to Use UMICP
214
263
 
215
264
  Use UMICP when:
265
+
216
266
  - **Large Payloads**: Inserting or searching large batches of vectors
217
267
  - **High Throughput**: Need maximum performance for production workloads
218
268
  - **Low Latency**: Need minimal protocol overhead
219
269
 
220
270
  Use HTTP when:
271
+
221
272
  - **Development**: Quick testing and debugging
222
273
  - **Firewall Restrictions**: Only HTTP/HTTPS allowed
223
274
  - **Simple Deployments**: No need for custom protocol setup
224
275
 
225
276
  #### Protocol Comparison
226
277
 
227
- | Feature | HTTP/HTTPS | UMICP |
228
- |---------|-----------|-------|
229
- | Transport | aiohttp (standard HTTP) | umicp-python package |
230
- | Performance | Standard | Optimized for large payloads |
231
- | Latency | Standard | Lower overhead |
232
- | Firewall | Widely supported | May require configuration |
233
- | Installation | Default | Requires umicp-python |
278
+ | Feature | HTTP/HTTPS | UMICP |
279
+ | ------------ | ----------------------- | ---------------------------- |
280
+ | Transport | aiohttp (standard HTTP) | umicp-python package |
281
+ | Performance | Standard | Optimized for large payloads |
282
+ | Latency | Standard | Lower overhead |
283
+ | Firewall | Widely supported | May require configuration |
284
+ | Installation | Default | Requires umicp-python |
234
285
 
235
286
  #### Installing with UMICP Support
236
287
 
@@ -1,21 +0,0 @@
1
- # MIT License
2
-
3
- Copyright (c) 2025 CMMV-Hive Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
File without changes