vectorizer-sdk 1.1.2__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.
- vectorizer_sdk-1.3.0/LICENSE +191 -0
- {vectorizer_sdk-1.1.2/vectorizer_sdk.egg-info → vectorizer_sdk-1.3.0}/PKG-INFO +62 -23
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/README.md +61 -22
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/pyproject.toml +2 -2
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_client_integration.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_discovery.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_exceptions.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_file_operations.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_http_client.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_intelligent_search.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_models.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_sdk_comprehensive.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_simple.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_umicp.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/tests/test_validation.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/utils/__init__.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/utils/http_client.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/utils/transport.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/utils/umicp_client.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/utils/validation.py +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0/vectorizer_sdk.egg-info}/PKG-INFO +62 -23
- vectorizer_sdk-1.1.2/LICENSE +0 -21
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/setup.cfg +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/SOURCES.txt +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/dependency_links.txt +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/entry_points.txt +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/requires.txt +0 -0
- {vectorizer_sdk-1.1.2 → vectorizer_sdk-1.3.0}/vectorizer_sdk.egg-info/top_level.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.
|
|
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:
|
|
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
|
|
@@ -51,12 +51,12 @@ Dynamic: license-file
|
|
|
51
51
|
|
|
52
52
|
[](https://pypi.org/project/vectorizer-sdk/)
|
|
53
53
|
[](https://pypi.org/project/vectorizer-sdk/)
|
|
54
|
-
[](LICENSE)
|
|
55
55
|
|
|
56
56
|
A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
57
57
|
|
|
58
58
|
**Package**: `vectorizer_sdk` (PEP 625 compliant)
|
|
59
|
-
**Version**: 1.0
|
|
59
|
+
**Version**: 1.3.0
|
|
60
60
|
**PyPI**: https://pypi.org/project/vectorizer-sdk/
|
|
61
61
|
|
|
62
62
|
## Features
|
|
@@ -64,11 +64,13 @@ A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
|
64
64
|
- **Multiple Transport Protocols**: HTTP/HTTPS and UMICP support
|
|
65
65
|
- **UMICP Protocol**: High-performance protocol using umicp-sdk package (v0.3.2+)
|
|
66
66
|
- **Vector Operations**: Insert, search, and manage vectors
|
|
67
|
-
- **Collection Management**: Create, delete, and monitor collections
|
|
67
|
+
- **Collection Management**: Create, delete, and monitor collections
|
|
68
68
|
- **Semantic Search**: Find similar content using embeddings
|
|
69
69
|
- **Intelligent Search**: Advanced multi-query search with domain expansion
|
|
70
70
|
- **Contextual Search**: Context-aware search with metadata filtering
|
|
71
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
|
|
72
74
|
- **Batch Operations**: Efficient bulk operations
|
|
73
75
|
- **Error Handling**: Comprehensive exception handling
|
|
74
76
|
- **Async Support**: Full async/await support for high performance
|
|
@@ -81,7 +83,7 @@ A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
|
81
83
|
pip install vectorizer-sdk
|
|
82
84
|
|
|
83
85
|
# Or specific version
|
|
84
|
-
pip install vectorizer-sdk==1.0
|
|
86
|
+
pip install vectorizer-sdk==1.3.0
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
## Quick Start
|
|
@@ -94,31 +96,31 @@ async def main():
|
|
|
94
96
|
async with VectorizerClient() as client:
|
|
95
97
|
# Create a collection
|
|
96
98
|
await client.create_collection("my_collection", dimension=512)
|
|
97
|
-
|
|
99
|
+
|
|
98
100
|
# Generate embedding
|
|
99
101
|
embedding = await client.embed_text("Hello, world!")
|
|
100
|
-
|
|
102
|
+
|
|
101
103
|
# Create vector
|
|
102
104
|
vector = Vector(
|
|
103
105
|
id="doc1",
|
|
104
106
|
data=embedding,
|
|
105
107
|
metadata={"text": "Hello, world!"}
|
|
106
108
|
)
|
|
107
|
-
|
|
109
|
+
|
|
108
110
|
# Insert text
|
|
109
111
|
await client.insert_texts("my_collection", [{
|
|
110
112
|
"id": "doc1",
|
|
111
113
|
"text": "Hello, world!",
|
|
112
114
|
"metadata": {"source": "example"}
|
|
113
115
|
}])
|
|
114
|
-
|
|
116
|
+
|
|
115
117
|
# Search for similar vectors
|
|
116
118
|
results = await client.search_vectors(
|
|
117
119
|
collection="my_collection",
|
|
118
120
|
query="greeting",
|
|
119
121
|
limit=5
|
|
120
122
|
)
|
|
121
|
-
|
|
123
|
+
|
|
122
124
|
# Intelligent search with multi-query expansion
|
|
123
125
|
from models import IntelligentSearchRequest
|
|
124
126
|
intelligent_results = await client.intelligent_search(
|
|
@@ -132,7 +134,7 @@ async def main():
|
|
|
132
134
|
mmr_lambda=0.7
|
|
133
135
|
)
|
|
134
136
|
)
|
|
135
|
-
|
|
137
|
+
|
|
136
138
|
# Semantic search with reranking
|
|
137
139
|
from models import SemanticSearchRequest
|
|
138
140
|
semantic_results = await client.semantic_search(
|
|
@@ -144,7 +146,7 @@ async def main():
|
|
|
144
146
|
similarity_threshold=0.6
|
|
145
147
|
)
|
|
146
148
|
)
|
|
147
|
-
|
|
149
|
+
|
|
148
150
|
# Contextual search with metadata filtering
|
|
149
151
|
from models import ContextualSearchRequest
|
|
150
152
|
contextual_results = await client.contextual_search(
|
|
@@ -156,7 +158,7 @@ async def main():
|
|
|
156
158
|
context_weight=0.4
|
|
157
159
|
)
|
|
158
160
|
)
|
|
159
|
-
|
|
161
|
+
|
|
160
162
|
# Multi-collection search
|
|
161
163
|
from models import MultiCollectionSearchRequest
|
|
162
164
|
multi_results = await client.multi_collection_search(
|
|
@@ -168,8 +170,43 @@ async def main():
|
|
|
168
170
|
cross_collection_reranking=True
|
|
169
171
|
)
|
|
170
172
|
)
|
|
171
|
-
|
|
172
|
-
|
|
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}")
|
|
173
210
|
|
|
174
211
|
asyncio.run(main())
|
|
175
212
|
```
|
|
@@ -225,24 +262,26 @@ client = VectorizerClient(
|
|
|
225
262
|
#### When to Use UMICP
|
|
226
263
|
|
|
227
264
|
Use UMICP when:
|
|
265
|
+
|
|
228
266
|
- **Large Payloads**: Inserting or searching large batches of vectors
|
|
229
267
|
- **High Throughput**: Need maximum performance for production workloads
|
|
230
268
|
- **Low Latency**: Need minimal protocol overhead
|
|
231
269
|
|
|
232
270
|
Use HTTP when:
|
|
271
|
+
|
|
233
272
|
- **Development**: Quick testing and debugging
|
|
234
273
|
- **Firewall Restrictions**: Only HTTP/HTTPS allowed
|
|
235
274
|
- **Simple Deployments**: No need for custom protocol setup
|
|
236
275
|
|
|
237
276
|
#### Protocol Comparison
|
|
238
277
|
|
|
239
|
-
| Feature
|
|
240
|
-
|
|
241
|
-
| Transport
|
|
242
|
-
| Performance
|
|
243
|
-
| Latency
|
|
244
|
-
| Firewall
|
|
245
|
-
| Installation | Default
|
|
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 |
|
|
246
285
|
|
|
247
286
|
#### Installing with UMICP Support
|
|
248
287
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/vectorizer-sdk/)
|
|
4
4
|
[](https://pypi.org/project/vectorizer-sdk/)
|
|
5
|
-
[](LICENSE)
|
|
6
6
|
|
|
7
7
|
A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
8
8
|
|
|
9
9
|
**Package**: `vectorizer_sdk` (PEP 625 compliant)
|
|
10
|
-
**Version**: 1.0
|
|
10
|
+
**Version**: 1.3.0
|
|
11
11
|
**PyPI**: https://pypi.org/project/vectorizer-sdk/
|
|
12
12
|
|
|
13
13
|
## Features
|
|
@@ -15,11 +15,13 @@ A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
|
15
15
|
- **Multiple Transport Protocols**: HTTP/HTTPS and UMICP support
|
|
16
16
|
- **UMICP Protocol**: High-performance protocol using umicp-sdk package (v0.3.2+)
|
|
17
17
|
- **Vector Operations**: Insert, search, and manage vectors
|
|
18
|
-
- **Collection Management**: Create, delete, and monitor collections
|
|
18
|
+
- **Collection Management**: Create, delete, and monitor collections
|
|
19
19
|
- **Semantic Search**: Find similar content using embeddings
|
|
20
20
|
- **Intelligent Search**: Advanced multi-query search with domain expansion
|
|
21
21
|
- **Contextual Search**: Context-aware search with metadata filtering
|
|
22
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
|
|
23
25
|
- **Batch Operations**: Efficient bulk operations
|
|
24
26
|
- **Error Handling**: Comprehensive exception handling
|
|
25
27
|
- **Async Support**: Full async/await support for high performance
|
|
@@ -32,7 +34,7 @@ A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
|
32
34
|
pip install vectorizer-sdk
|
|
33
35
|
|
|
34
36
|
# Or specific version
|
|
35
|
-
pip install vectorizer-sdk==1.0
|
|
37
|
+
pip install vectorizer-sdk==1.3.0
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
## Quick Start
|
|
@@ -45,31 +47,31 @@ async def main():
|
|
|
45
47
|
async with VectorizerClient() as client:
|
|
46
48
|
# Create a collection
|
|
47
49
|
await client.create_collection("my_collection", dimension=512)
|
|
48
|
-
|
|
50
|
+
|
|
49
51
|
# Generate embedding
|
|
50
52
|
embedding = await client.embed_text("Hello, world!")
|
|
51
|
-
|
|
53
|
+
|
|
52
54
|
# Create vector
|
|
53
55
|
vector = Vector(
|
|
54
56
|
id="doc1",
|
|
55
57
|
data=embedding,
|
|
56
58
|
metadata={"text": "Hello, world!"}
|
|
57
59
|
)
|
|
58
|
-
|
|
60
|
+
|
|
59
61
|
# Insert text
|
|
60
62
|
await client.insert_texts("my_collection", [{
|
|
61
63
|
"id": "doc1",
|
|
62
64
|
"text": "Hello, world!",
|
|
63
65
|
"metadata": {"source": "example"}
|
|
64
66
|
}])
|
|
65
|
-
|
|
67
|
+
|
|
66
68
|
# Search for similar vectors
|
|
67
69
|
results = await client.search_vectors(
|
|
68
70
|
collection="my_collection",
|
|
69
71
|
query="greeting",
|
|
70
72
|
limit=5
|
|
71
73
|
)
|
|
72
|
-
|
|
74
|
+
|
|
73
75
|
# Intelligent search with multi-query expansion
|
|
74
76
|
from models import IntelligentSearchRequest
|
|
75
77
|
intelligent_results = await client.intelligent_search(
|
|
@@ -83,7 +85,7 @@ async def main():
|
|
|
83
85
|
mmr_lambda=0.7
|
|
84
86
|
)
|
|
85
87
|
)
|
|
86
|
-
|
|
88
|
+
|
|
87
89
|
# Semantic search with reranking
|
|
88
90
|
from models import SemanticSearchRequest
|
|
89
91
|
semantic_results = await client.semantic_search(
|
|
@@ -95,7 +97,7 @@ async def main():
|
|
|
95
97
|
similarity_threshold=0.6
|
|
96
98
|
)
|
|
97
99
|
)
|
|
98
|
-
|
|
100
|
+
|
|
99
101
|
# Contextual search with metadata filtering
|
|
100
102
|
from models import ContextualSearchRequest
|
|
101
103
|
contextual_results = await client.contextual_search(
|
|
@@ -107,7 +109,7 @@ async def main():
|
|
|
107
109
|
context_weight=0.4
|
|
108
110
|
)
|
|
109
111
|
)
|
|
110
|
-
|
|
112
|
+
|
|
111
113
|
# Multi-collection search
|
|
112
114
|
from models import MultiCollectionSearchRequest
|
|
113
115
|
multi_results = await client.multi_collection_search(
|
|
@@ -119,8 +121,43 @@ async def main():
|
|
|
119
121
|
cross_collection_reranking=True
|
|
120
122
|
)
|
|
121
123
|
)
|
|
122
|
-
|
|
123
|
-
|
|
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}")
|
|
124
161
|
|
|
125
162
|
asyncio.run(main())
|
|
126
163
|
```
|
|
@@ -176,24 +213,26 @@ client = VectorizerClient(
|
|
|
176
213
|
#### When to Use UMICP
|
|
177
214
|
|
|
178
215
|
Use UMICP when:
|
|
216
|
+
|
|
179
217
|
- **Large Payloads**: Inserting or searching large batches of vectors
|
|
180
218
|
- **High Throughput**: Need maximum performance for production workloads
|
|
181
219
|
- **Low Latency**: Need minimal protocol overhead
|
|
182
220
|
|
|
183
221
|
Use HTTP when:
|
|
222
|
+
|
|
184
223
|
- **Development**: Quick testing and debugging
|
|
185
224
|
- **Firewall Restrictions**: Only HTTP/HTTPS allowed
|
|
186
225
|
- **Simple Deployments**: No need for custom protocol setup
|
|
187
226
|
|
|
188
227
|
#### Protocol Comparison
|
|
189
228
|
|
|
190
|
-
| Feature
|
|
191
|
-
|
|
192
|
-
| Transport
|
|
193
|
-
| Performance
|
|
194
|
-
| Latency
|
|
195
|
-
| Firewall
|
|
196
|
-
| Installation | Default
|
|
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 |
|
|
197
236
|
|
|
198
237
|
#### Installing with UMICP Support
|
|
199
238
|
|
|
@@ -264,4 +303,4 @@ MIT License - see LICENSE file for details.
|
|
|
264
303
|
## Support
|
|
265
304
|
|
|
266
305
|
- GitHub Issues: https://github.com/cmmv-hive/vectorizer/issues
|
|
267
|
-
- 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.
|
|
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 = "
|
|
11
|
+
license = "Apache-2.0"
|
|
12
12
|
authors = [
|
|
13
13
|
{name = "HiveLLM Team", email = "team@hivellm.org"}
|
|
14
14
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vectorizer_sdk
|
|
3
|
-
Version: 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:
|
|
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
|
|
@@ -51,12 +51,12 @@ Dynamic: license-file
|
|
|
51
51
|
|
|
52
52
|
[](https://pypi.org/project/vectorizer-sdk/)
|
|
53
53
|
[](https://pypi.org/project/vectorizer-sdk/)
|
|
54
|
-
[](LICENSE)
|
|
55
55
|
|
|
56
56
|
A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
57
57
|
|
|
58
58
|
**Package**: `vectorizer_sdk` (PEP 625 compliant)
|
|
59
|
-
**Version**: 1.0
|
|
59
|
+
**Version**: 1.3.0
|
|
60
60
|
**PyPI**: https://pypi.org/project/vectorizer-sdk/
|
|
61
61
|
|
|
62
62
|
## Features
|
|
@@ -64,11 +64,13 @@ A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
|
64
64
|
- **Multiple Transport Protocols**: HTTP/HTTPS and UMICP support
|
|
65
65
|
- **UMICP Protocol**: High-performance protocol using umicp-sdk package (v0.3.2+)
|
|
66
66
|
- **Vector Operations**: Insert, search, and manage vectors
|
|
67
|
-
- **Collection Management**: Create, delete, and monitor collections
|
|
67
|
+
- **Collection Management**: Create, delete, and monitor collections
|
|
68
68
|
- **Semantic Search**: Find similar content using embeddings
|
|
69
69
|
- **Intelligent Search**: Advanced multi-query search with domain expansion
|
|
70
70
|
- **Contextual Search**: Context-aware search with metadata filtering
|
|
71
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
|
|
72
74
|
- **Batch Operations**: Efficient bulk operations
|
|
73
75
|
- **Error Handling**: Comprehensive exception handling
|
|
74
76
|
- **Async Support**: Full async/await support for high performance
|
|
@@ -81,7 +83,7 @@ A comprehensive Python SDK for the Vectorizer semantic search service.
|
|
|
81
83
|
pip install vectorizer-sdk
|
|
82
84
|
|
|
83
85
|
# Or specific version
|
|
84
|
-
pip install vectorizer-sdk==1.0
|
|
86
|
+
pip install vectorizer-sdk==1.3.0
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
## Quick Start
|
|
@@ -94,31 +96,31 @@ async def main():
|
|
|
94
96
|
async with VectorizerClient() as client:
|
|
95
97
|
# Create a collection
|
|
96
98
|
await client.create_collection("my_collection", dimension=512)
|
|
97
|
-
|
|
99
|
+
|
|
98
100
|
# Generate embedding
|
|
99
101
|
embedding = await client.embed_text("Hello, world!")
|
|
100
|
-
|
|
102
|
+
|
|
101
103
|
# Create vector
|
|
102
104
|
vector = Vector(
|
|
103
105
|
id="doc1",
|
|
104
106
|
data=embedding,
|
|
105
107
|
metadata={"text": "Hello, world!"}
|
|
106
108
|
)
|
|
107
|
-
|
|
109
|
+
|
|
108
110
|
# Insert text
|
|
109
111
|
await client.insert_texts("my_collection", [{
|
|
110
112
|
"id": "doc1",
|
|
111
113
|
"text": "Hello, world!",
|
|
112
114
|
"metadata": {"source": "example"}
|
|
113
115
|
}])
|
|
114
|
-
|
|
116
|
+
|
|
115
117
|
# Search for similar vectors
|
|
116
118
|
results = await client.search_vectors(
|
|
117
119
|
collection="my_collection",
|
|
118
120
|
query="greeting",
|
|
119
121
|
limit=5
|
|
120
122
|
)
|
|
121
|
-
|
|
123
|
+
|
|
122
124
|
# Intelligent search with multi-query expansion
|
|
123
125
|
from models import IntelligentSearchRequest
|
|
124
126
|
intelligent_results = await client.intelligent_search(
|
|
@@ -132,7 +134,7 @@ async def main():
|
|
|
132
134
|
mmr_lambda=0.7
|
|
133
135
|
)
|
|
134
136
|
)
|
|
135
|
-
|
|
137
|
+
|
|
136
138
|
# Semantic search with reranking
|
|
137
139
|
from models import SemanticSearchRequest
|
|
138
140
|
semantic_results = await client.semantic_search(
|
|
@@ -144,7 +146,7 @@ async def main():
|
|
|
144
146
|
similarity_threshold=0.6
|
|
145
147
|
)
|
|
146
148
|
)
|
|
147
|
-
|
|
149
|
+
|
|
148
150
|
# Contextual search with metadata filtering
|
|
149
151
|
from models import ContextualSearchRequest
|
|
150
152
|
contextual_results = await client.contextual_search(
|
|
@@ -156,7 +158,7 @@ async def main():
|
|
|
156
158
|
context_weight=0.4
|
|
157
159
|
)
|
|
158
160
|
)
|
|
159
|
-
|
|
161
|
+
|
|
160
162
|
# Multi-collection search
|
|
161
163
|
from models import MultiCollectionSearchRequest
|
|
162
164
|
multi_results = await client.multi_collection_search(
|
|
@@ -168,8 +170,43 @@ async def main():
|
|
|
168
170
|
cross_collection_reranking=True
|
|
169
171
|
)
|
|
170
172
|
)
|
|
171
|
-
|
|
172
|
-
|
|
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}")
|
|
173
210
|
|
|
174
211
|
asyncio.run(main())
|
|
175
212
|
```
|
|
@@ -225,24 +262,26 @@ client = VectorizerClient(
|
|
|
225
262
|
#### When to Use UMICP
|
|
226
263
|
|
|
227
264
|
Use UMICP when:
|
|
265
|
+
|
|
228
266
|
- **Large Payloads**: Inserting or searching large batches of vectors
|
|
229
267
|
- **High Throughput**: Need maximum performance for production workloads
|
|
230
268
|
- **Low Latency**: Need minimal protocol overhead
|
|
231
269
|
|
|
232
270
|
Use HTTP when:
|
|
271
|
+
|
|
233
272
|
- **Development**: Quick testing and debugging
|
|
234
273
|
- **Firewall Restrictions**: Only HTTP/HTTPS allowed
|
|
235
274
|
- **Simple Deployments**: No need for custom protocol setup
|
|
236
275
|
|
|
237
276
|
#### Protocol Comparison
|
|
238
277
|
|
|
239
|
-
| Feature
|
|
240
|
-
|
|
241
|
-
| Transport
|
|
242
|
-
| Performance
|
|
243
|
-
| Latency
|
|
244
|
-
| Firewall
|
|
245
|
-
| Installation | Default
|
|
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 |
|
|
246
285
|
|
|
247
286
|
#### Installing with UMICP Support
|
|
248
287
|
|
vectorizer_sdk-1.1.2/LICENSE
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|