vecmindb 1.2.0__tar.gz → 1.2.2__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.
- {vecmindb-1.2.0 → vecmindb-1.2.2}/PKG-INFO +3 -2
- {vecmindb-1.2.0 → vecmindb-1.2.2}/pyproject.toml +3 -2
- {vecmindb-1.2.0 → vecmindb-1.2.2}/tests/test_client.py +2 -1
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/__init__.py +1 -1
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/async_client.py +21 -7
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/client.py +20 -7
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/models.py +29 -6
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb.egg-info/PKG-INFO +3 -2
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb.egg-info/requires.txt +2 -1
- {vecmindb-1.2.0 → vecmindb-1.2.2}/README.md +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/setup.cfg +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/tests/test_agent_memory.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/tests/test_agent_turns.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/tests/test_integrations.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/agent_turns.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/auth.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/exceptions.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/gate_calibrate.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/integrations/__init__.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/integrations/langchain.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/integrations/llamaindex.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/mcp.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/mcp_server.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/memory.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/memory_plugin.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/py.typed +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb/retry.py +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb.egg-info/SOURCES.txt +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb.egg-info/dependency_links.txt +0 -0
- {vecmindb-1.2.0 → vecmindb-1.2.2}/vecmindb.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vecmindb
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Python SDK for VecminDB - High-performance vector database HTTP client
|
|
5
5
|
Author-email: VecminDB Team <contact@lingxinmind.com>
|
|
6
6
|
License: MIT OR Apache-2.0
|
|
@@ -24,7 +24,8 @@ Classifier: Topic :: Database
|
|
|
24
24
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
25
|
Requires-Python: >=3.8
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
|
-
Requires-Dist:
|
|
27
|
+
Requires-Dist: httpx>=0.24.0
|
|
28
|
+
Requires-Dist: pydantic<3.0,>=2.0
|
|
28
29
|
Provides-Extra: dev
|
|
29
30
|
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
30
31
|
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "vecmindb"
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.2"
|
|
8
8
|
description = "Python SDK for VecminDB - High-performance vector database HTTP client"
|
|
9
9
|
authors = [{email = "contact@lingxinmind.com", name = "VecminDB Team"}]
|
|
10
10
|
license = {text = "MIT OR Apache-2.0"}
|
|
@@ -28,7 +28,8 @@ classifiers = [
|
|
|
28
28
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
29
29
|
]
|
|
30
30
|
dependencies = [
|
|
31
|
-
"
|
|
31
|
+
"httpx>=0.24.0",
|
|
32
|
+
"pydantic>=2.0,<3.0",
|
|
32
33
|
]
|
|
33
34
|
|
|
34
35
|
[project.optional-dependencies]
|
|
@@ -42,12 +42,13 @@ class TestModels(unittest.TestCase):
|
|
|
42
42
|
|
|
43
43
|
def test_search_request(self):
|
|
44
44
|
req = SearchRequest(query=[0.1, 0.2, 0.3], k=5, ef_search=100)
|
|
45
|
-
self.assertEqual(req.
|
|
45
|
+
self.assertEqual(req.top_k, 5)
|
|
46
46
|
self.assertEqual(len(req.query), 3)
|
|
47
47
|
|
|
48
48
|
def test_insert_request(self):
|
|
49
49
|
req = InsertRequest(values=[0.1, 0.2], id="vec-1", metadata={"key": "val"})
|
|
50
50
|
self.assertEqual(req.id, "vec-1")
|
|
51
|
+
self.assertEqual(req.data, [0.1, 0.2])
|
|
51
52
|
self.assertEqual(req.metadata["key"], "val")
|
|
52
53
|
|
|
53
54
|
def test_search_response(self):
|
|
@@ -504,7 +504,7 @@ class AsyncVecminClient:
|
|
|
504
504
|
Returns:
|
|
505
505
|
The vector identifier.
|
|
506
506
|
"""
|
|
507
|
-
payload = InsertRequest(id=id,
|
|
507
|
+
payload = InsertRequest(id=id or str(uuid.uuid4()), data=vector, metadata=metadata)
|
|
508
508
|
data = await self._api_post(
|
|
509
509
|
f"/collections/{collection}/vectors",
|
|
510
510
|
payload.model_dump(exclude_none=True),
|
|
@@ -526,19 +526,33 @@ class AsyncVecminClient:
|
|
|
526
526
|
|
|
527
527
|
Args:
|
|
528
528
|
collection: Target collection name.
|
|
529
|
-
vectors: List of dicts with keys ``
|
|
529
|
+
vectors: List of dicts with keys ``data`` (or legacy ``values``),
|
|
530
|
+
``id``, ``metadata``.
|
|
530
531
|
|
|
531
532
|
Returns:
|
|
532
533
|
List of inserted vector identifiers.
|
|
534
|
+
|
|
535
|
+
Note:
|
|
536
|
+
The batch endpoint requires consensus (distributed) mode; on a
|
|
537
|
+
standalone node the server responds with an internal error.
|
|
533
538
|
"""
|
|
534
|
-
|
|
535
|
-
|
|
539
|
+
operations = [
|
|
540
|
+
{
|
|
541
|
+
"type": "add",
|
|
542
|
+
"id": v.get("id") or str(uuid.uuid4()),
|
|
543
|
+
"data": v.get("data", v.get("values", v.get("vector"))),
|
|
544
|
+
"metadata": v.get("metadata"),
|
|
545
|
+
}
|
|
546
|
+
for v in vectors
|
|
547
|
+
]
|
|
536
548
|
data = await self._api_post(
|
|
537
549
|
f"/collections/{collection}/batch",
|
|
538
|
-
|
|
550
|
+
{"operations": operations},
|
|
539
551
|
**kw,
|
|
540
552
|
)
|
|
541
553
|
result = data.get("data", data)
|
|
554
|
+
if isinstance(result, dict):
|
|
555
|
+
result = result.get("ids", result.get("vectors", []))
|
|
542
556
|
if isinstance(result, list):
|
|
543
557
|
return [r.get("id", str(r)) if isinstance(r, dict) else str(r) for r in result]
|
|
544
558
|
return [str(result)]
|
|
@@ -567,7 +581,7 @@ class AsyncVecminClient:
|
|
|
567
581
|
Returns:
|
|
568
582
|
Search results.
|
|
569
583
|
"""
|
|
570
|
-
payload = SearchRequest(query=query,
|
|
584
|
+
payload = SearchRequest(query=query, top_k=top_k, ef_search=ef_search, metric=metric, filter=filter)
|
|
571
585
|
data = await self._api_post(
|
|
572
586
|
f"/collections/{collection}/search",
|
|
573
587
|
payload.model_dump(exclude_none=True),
|
|
@@ -773,7 +787,7 @@ class AsyncVecminClient:
|
|
|
773
787
|
Returns:
|
|
774
788
|
Search results.
|
|
775
789
|
"""
|
|
776
|
-
payload = SearchRequest(query=query,
|
|
790
|
+
payload = SearchRequest(query=query, top_k=top_k, ef_search=ef_search, metric=metric, filter=filter)
|
|
777
791
|
data = await self._api_post("/vectors/search", payload.model_dump(exclude_none=True), **kw)
|
|
778
792
|
raw = data.get("data", data)
|
|
779
793
|
if isinstance(raw, list):
|
|
@@ -385,7 +385,7 @@ class VecminClient:
|
|
|
385
385
|
Returns:
|
|
386
386
|
The vector identifier.
|
|
387
387
|
"""
|
|
388
|
-
payload = InsertRequest(id=id,
|
|
388
|
+
payload = InsertRequest(id=id or str(uuid.uuid4()), data=vector, metadata=metadata)
|
|
389
389
|
data = self._api_post(
|
|
390
390
|
f"/collections/{collection}/vectors",
|
|
391
391
|
payload.model_dump(exclude_none=True),
|
|
@@ -403,15 +403,28 @@ class VecminClient:
|
|
|
403
403
|
vectors: List[Dict[str, Any]],
|
|
404
404
|
**kw,
|
|
405
405
|
) -> List[str]:
|
|
406
|
-
"""Batch insert vectors into a collection (``POST /api/v1/collections/{name}/batch``).
|
|
407
|
-
|
|
408
|
-
|
|
406
|
+
"""Batch insert vectors into a collection (``POST /api/v1/collections/{name}/batch``).
|
|
407
|
+
|
|
408
|
+
Note: the batch endpoint requires consensus (distributed) mode; on a
|
|
409
|
+
standalone node the server responds with an internal error.
|
|
410
|
+
"""
|
|
411
|
+
operations = [
|
|
412
|
+
{
|
|
413
|
+
"type": "add",
|
|
414
|
+
"id": v.get("id") or str(uuid.uuid4()),
|
|
415
|
+
"data": v.get("data", v.get("values", v.get("vector"))),
|
|
416
|
+
"metadata": v.get("metadata"),
|
|
417
|
+
}
|
|
418
|
+
for v in vectors
|
|
419
|
+
]
|
|
409
420
|
data = self._api_post(
|
|
410
421
|
f"/collections/{collection}/batch",
|
|
411
|
-
|
|
422
|
+
{"operations": operations},
|
|
412
423
|
**kw,
|
|
413
424
|
)
|
|
414
425
|
result = data.get("data", data)
|
|
426
|
+
if isinstance(result, dict):
|
|
427
|
+
result = result.get("ids", result.get("vectors", []))
|
|
415
428
|
if isinstance(result, list):
|
|
416
429
|
return [r.get("id", str(r)) if isinstance(r, dict) else str(r) for r in result]
|
|
417
430
|
return [str(result)]
|
|
@@ -428,7 +441,7 @@ class VecminClient:
|
|
|
428
441
|
**kw,
|
|
429
442
|
) -> SearchResponse:
|
|
430
443
|
"""Search a collection for nearest neighbours (``POST /api/v1/collections/{name}/search``)."""
|
|
431
|
-
payload = SearchRequest(query=query,
|
|
444
|
+
payload = SearchRequest(query=query, top_k=top_k, ef_search=ef_search, metric=metric, filter=filter)
|
|
432
445
|
data = self._api_post(
|
|
433
446
|
f"/collections/{collection}/search",
|
|
434
447
|
payload.model_dump(exclude_none=True),
|
|
@@ -566,7 +579,7 @@ class VecminClient:
|
|
|
566
579
|
**kw,
|
|
567
580
|
) -> SearchResponse:
|
|
568
581
|
"""Global vector search (``POST /api/v1/vectors/search``)."""
|
|
569
|
-
payload = SearchRequest(query=query,
|
|
582
|
+
payload = SearchRequest(query=query, top_k=top_k, ef_search=ef_search, metric=metric, filter=filter)
|
|
570
583
|
data = self._api_post("/vectors/search", payload.model_dump(exclude_none=True), **kw)
|
|
571
584
|
raw = data.get("data", data)
|
|
572
585
|
if isinstance(raw, list):
|
|
@@ -9,7 +9,7 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
from typing import Any, Dict, List, Optional, Union
|
|
11
11
|
|
|
12
|
-
from pydantic import BaseModel, Field
|
|
12
|
+
from pydantic import BaseModel, Field, model_validator
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
# ===========================================================================
|
|
@@ -106,16 +106,28 @@ class CollectionStats(BaseModel):
|
|
|
106
106
|
class InsertRequest(BaseModel):
|
|
107
107
|
"""Payload for inserting a single vector into a collection.
|
|
108
108
|
|
|
109
|
+
Server wire format reads ``id`` (required), ``data`` (pre-computed vector)
|
|
110
|
+
or ``text`` (auto-embedding). The legacy ``values`` key is still accepted
|
|
111
|
+
and mapped to ``data`` for backwards compatibility.
|
|
112
|
+
|
|
109
113
|
Attributes:
|
|
110
|
-
id:
|
|
111
|
-
|
|
114
|
+
id: Client-assigned vector identifier (UUID-generated when omitted).
|
|
115
|
+
data: The embedding vector.
|
|
112
116
|
metadata: Arbitrary key-value metadata.
|
|
113
117
|
"""
|
|
114
118
|
|
|
115
119
|
id: Optional[str] = None
|
|
116
|
-
|
|
120
|
+
data: List[float]
|
|
117
121
|
metadata: Optional[Dict[str, Any]] = None
|
|
118
122
|
|
|
123
|
+
@model_validator(mode="before")
|
|
124
|
+
@classmethod
|
|
125
|
+
def _accept_legacy_values(cls, values_obj: Any) -> Any:
|
|
126
|
+
"""Back-compat: accept the retired ``values`` key as ``data``."""
|
|
127
|
+
if isinstance(values_obj, dict) and "values" in values_obj and "data" not in values_obj:
|
|
128
|
+
values_obj = {**values_obj, "data": values_obj.pop("values")}
|
|
129
|
+
return values_obj
|
|
130
|
+
|
|
119
131
|
|
|
120
132
|
class BatchInsertRequest(BaseModel):
|
|
121
133
|
"""Payload for ``POST /api/v1/collections/{name}/batch``.
|
|
@@ -130,20 +142,31 @@ class BatchInsertRequest(BaseModel):
|
|
|
130
142
|
class SearchRequest(BaseModel):
|
|
131
143
|
"""Payload for vector similarity search.
|
|
132
144
|
|
|
145
|
+
The server reads ``top_k`` for the result count; the legacy ``k`` key is
|
|
146
|
+
still accepted and mapped to ``top_k`` for backwards compatibility.
|
|
147
|
+
|
|
133
148
|
Attributes:
|
|
134
149
|
query: The query embedding vector.
|
|
135
|
-
|
|
150
|
+
top_k: Number of nearest neighbours to return.
|
|
136
151
|
ef_search: HNSW search-width parameter.
|
|
137
152
|
metric: Override the default distance metric.
|
|
138
153
|
filter: Optional metadata filter expression.
|
|
139
154
|
"""
|
|
140
155
|
|
|
141
156
|
query: List[float]
|
|
142
|
-
|
|
157
|
+
top_k: int = 10
|
|
143
158
|
ef_search: int = 50
|
|
144
159
|
metric: Optional[str] = None
|
|
145
160
|
filter: Optional[Dict[str, Any]] = None
|
|
146
161
|
|
|
162
|
+
@model_validator(mode="before")
|
|
163
|
+
@classmethod
|
|
164
|
+
def _accept_legacy_k(cls, values_obj: Any) -> Any:
|
|
165
|
+
"""Back-compat: accept the retired ``k`` key as ``top_k``."""
|
|
166
|
+
if isinstance(values_obj, dict) and "k" in values_obj and "top_k" not in values_obj:
|
|
167
|
+
values_obj = {**values_obj, "top_k": values_obj.pop("k")}
|
|
168
|
+
return values_obj
|
|
169
|
+
|
|
147
170
|
|
|
148
171
|
class SearchHit(BaseModel):
|
|
149
172
|
"""A single result from a vector similarity search.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vecmindb
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Python SDK for VecminDB - High-performance vector database HTTP client
|
|
5
5
|
Author-email: VecminDB Team <contact@lingxinmind.com>
|
|
6
6
|
License: MIT OR Apache-2.0
|
|
@@ -24,7 +24,8 @@ Classifier: Topic :: Database
|
|
|
24
24
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
25
|
Requires-Python: >=3.8
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
|
-
Requires-Dist:
|
|
27
|
+
Requires-Dist: httpx>=0.24.0
|
|
28
|
+
Requires-Dist: pydantic<3.0,>=2.0
|
|
28
29
|
Provides-Extra: dev
|
|
29
30
|
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
30
31
|
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|