massengine 1.1.3__tar.gz → 1.2.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.
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: massengine
3
- Version: 1.1.3
4
- Summary: Official Python SDK for the MassEngine vector and hybrid search database.
3
+ Version: 1.2.0
4
+ Summary: Official Python SDK for the MassEngine filtered vector and hybrid search database.
5
5
  Project-URL: Homepage, https://massengine.com
6
6
  Project-URL: Documentation, https://massengine.com/docs
7
7
  Project-URL: Repository, https://github.com/massengine-dev/massengine-python
8
8
  Author-email: MassEngine <dev@massengine.com>
9
9
  License-Expression: Apache-2.0
10
10
  License-File: LICENSE
11
- Keywords: bm25,embeddings,hybrid-search,massengine,rag,vector-database
11
+ Keywords: bm25,embeddings,hybrid-search,massengine,rag,vector-database,vector-search
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: Programming Language :: Python :: 3
@@ -24,7 +24,7 @@ Description-Content-Type: text/markdown
24
24
 
25
25
  # MassEngine Python SDK (`massengine`)
26
26
 
27
- Official zero-dependency Python client for [MassEngine](https://massengine.com) — the sub-5ms filtered and hybrid vector search database.
27
+ Official zero-dependency Python client for [MassEngine](https://massengine.com) — the sub-5ms filtered vector and hybrid search database.
28
28
 
29
29
  ## Installation
30
30
 
@@ -43,12 +43,12 @@ client = MassEngineClient(
43
43
  api_key="mk_your_tenant_or_meadm_admin_key",
44
44
  )
45
45
 
46
- # 1. Ingest vectors + structured metadata
46
+ # 1. Ingest dense vectors + structured metadata
47
47
  client.ingest(
48
48
  "acme-prod",
49
49
  [
50
50
  Doc(
51
- id="doc-1",
51
+ id="docs/2026/policy-1",
52
52
  vector=[0.12, -0.44, 0.88, 0.05],
53
53
  category=1,
54
54
  metadata={"department": "security", "clearance": 3, "tags": ["soc2", "policy"]},
@@ -56,12 +56,10 @@ client.ingest(
56
56
  ],
57
57
  )
58
58
 
59
- # 2. Hybrid dense + BM25 search with rich metadata filter operators
59
+ # 2. Dense vector search with rich metadata filter operators
60
60
  res = client.search(
61
61
  "acme-prod",
62
62
  vector=[0.12, -0.44, 0.88, 0.05],
63
- query_text="soc2 policy",
64
- hybrid_alpha=0.7,
65
63
  k=10,
66
64
  min_score=0.5,
67
65
  metadata_filter={
@@ -72,18 +70,44 @@ res = client.search(
72
70
  )
73
71
  print(res["hits"])
74
72
 
75
- # 3. In-place metadata patching without re-embedding
73
+ # 3. Hybrid search (dense + BM25 lexical + sparse vectors with weighted RRF)
74
+ hybrid = client.search(
75
+ "acme-prod",
76
+ vector=[0.12, -0.44, 0.88, 0.05],
77
+ query_text="soc2 security policy",
78
+ hybrid_alpha=0.6,
79
+ k=10,
80
+ )
81
+ print(hybrid["hits"])
82
+
83
+ # 4. In-place metadata patching without re-embedding
76
84
  client.patch_doc(
77
85
  "acme-prod",
78
- "doc-1",
86
+ "docs/2026/policy-1",
79
87
  metadata={"clearance": 4, "reviewed": True},
80
88
  )
81
89
 
82
- # 4. Inspect tenant quota & billable usage
90
+ # 5. Inspect tenant quota & billable usage
83
91
  usage = client.get_tenant_usage("acme-prod")
84
92
  print(usage)
85
93
  ```
86
94
 
95
+ ## Multi-Database Scoping
96
+
97
+ Create isolated databases within a tenant and scope operations using `database=` (pass `tenant=""` when authenticating with a tenant-scoped `mk_...` key):
98
+
99
+ ```python
100
+ client.create_database("", "analytics", data_type="int8")
101
+
102
+ client.ingest(
103
+ "",
104
+ [Doc(id="event-1", vector=[0.1, 0.2, 0.3, 0.4])],
105
+ database="analytics",
106
+ )
107
+
108
+ hits = client.search("", vector=[0.1, 0.2, 0.3, 0.4], database="analytics", k=5)
109
+ ```
110
+
87
111
  ## License
88
112
 
89
113
  Apache License 2.0
@@ -1,6 +1,6 @@
1
1
  # MassEngine Python SDK (`massengine`)
2
2
 
3
- Official zero-dependency Python client for [MassEngine](https://massengine.com) — the sub-5ms filtered and hybrid vector search database.
3
+ Official zero-dependency Python client for [MassEngine](https://massengine.com) — the sub-5ms filtered vector and hybrid search database.
4
4
 
5
5
  ## Installation
6
6
 
@@ -19,12 +19,12 @@ client = MassEngineClient(
19
19
  api_key="mk_your_tenant_or_meadm_admin_key",
20
20
  )
21
21
 
22
- # 1. Ingest vectors + structured metadata
22
+ # 1. Ingest dense vectors + structured metadata
23
23
  client.ingest(
24
24
  "acme-prod",
25
25
  [
26
26
  Doc(
27
- id="doc-1",
27
+ id="docs/2026/policy-1",
28
28
  vector=[0.12, -0.44, 0.88, 0.05],
29
29
  category=1,
30
30
  metadata={"department": "security", "clearance": 3, "tags": ["soc2", "policy"]},
@@ -32,12 +32,10 @@ client.ingest(
32
32
  ],
33
33
  )
34
34
 
35
- # 2. Hybrid dense + BM25 search with rich metadata filter operators
35
+ # 2. Dense vector search with rich metadata filter operators
36
36
  res = client.search(
37
37
  "acme-prod",
38
38
  vector=[0.12, -0.44, 0.88, 0.05],
39
- query_text="soc2 policy",
40
- hybrid_alpha=0.7,
41
39
  k=10,
42
40
  min_score=0.5,
43
41
  metadata_filter={
@@ -48,18 +46,44 @@ res = client.search(
48
46
  )
49
47
  print(res["hits"])
50
48
 
51
- # 3. In-place metadata patching without re-embedding
49
+ # 3. Hybrid search (dense + BM25 lexical + sparse vectors with weighted RRF)
50
+ hybrid = client.search(
51
+ "acme-prod",
52
+ vector=[0.12, -0.44, 0.88, 0.05],
53
+ query_text="soc2 security policy",
54
+ hybrid_alpha=0.6,
55
+ k=10,
56
+ )
57
+ print(hybrid["hits"])
58
+
59
+ # 4. In-place metadata patching without re-embedding
52
60
  client.patch_doc(
53
61
  "acme-prod",
54
- "doc-1",
62
+ "docs/2026/policy-1",
55
63
  metadata={"clearance": 4, "reviewed": True},
56
64
  )
57
65
 
58
- # 4. Inspect tenant quota & billable usage
66
+ # 5. Inspect tenant quota & billable usage
59
67
  usage = client.get_tenant_usage("acme-prod")
60
68
  print(usage)
61
69
  ```
62
70
 
71
+ ## Multi-Database Scoping
72
+
73
+ Create isolated databases within a tenant and scope operations using `database=` (pass `tenant=""` when authenticating with a tenant-scoped `mk_...` key):
74
+
75
+ ```python
76
+ client.create_database("", "analytics", data_type="int8")
77
+
78
+ client.ingest(
79
+ "",
80
+ [Doc(id="event-1", vector=[0.1, 0.2, 0.3, 0.4])],
81
+ database="analytics",
82
+ )
83
+
84
+ hits = client.search("", vector=[0.1, 0.2, 0.3, 0.4], database="analytics", k=5)
85
+ ```
86
+
63
87
  ## License
64
88
 
65
89
  Apache License 2.0