memoryintelligence 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- memoryintelligence/__init__.py +153 -0
- memoryintelligence/edge_client.py +384 -0
- memoryintelligence/memory_client.py +688 -0
- memoryintelligence/mi_types.py +364 -0
- memoryintelligence-1.0.0.dist-info/METADATA +428 -0
- memoryintelligence-1.0.0.dist-info/RECORD +9 -0
- memoryintelligence-1.0.0.dist-info/WHEEL +5 -0
- memoryintelligence-1.0.0.dist-info/licenses/LICENSE +31 -0
- memoryintelligence-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memoryintelligence
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK for Memory Intelligence - Verifiable meaning infrastructure for AI
|
|
5
|
+
Author-email: Memory Intelligence Team <sdk@memoryintelligence.dev>
|
|
6
|
+
Maintainer-email: Memory Intelligence Team <sdk@memoryintelligence.dev>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://memoryintelligence.dev
|
|
9
|
+
Project-URL: Documentation, https://docs.memoryintelligence.dev
|
|
10
|
+
Project-URL: Repository, https://github.com/memoryintelligence/sdk-python
|
|
11
|
+
Project-URL: Changelog, https://github.com/memoryintelligence/sdk-python/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: ai,llm,memory,rag,embeddings,nlp,privacy,compliance,hipaa,gdpr,provenance
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: httpx>=0.24.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
## Memory Intelligence Python SDK
|
|
38
|
+
|
|
39
|
+
Official Python client for building applications, agents, integrations, and data pipelines on top of the Memory Intelligence OS.
|
|
40
|
+
|
|
41
|
+
The Python SDK provides a full-featured interface for interacting with the Memory Intelligence Operating System (MemoryOS).
|
|
42
|
+
It is optimized for:
|
|
43
|
+
• backend services
|
|
44
|
+
• data ingestion pipelines
|
|
45
|
+
• ML research & evaluation
|
|
46
|
+
• analytics & ETL
|
|
47
|
+
• agent development
|
|
48
|
+
• enterprise automation workflows
|
|
49
|
+
|
|
50
|
+
It supports both sync and async usage, enforces all governance + privacy rules, and provides high-level helpers for working with UMOs, search, timelines, clusters, provenance, and agents.
|
|
51
|
+
|
|
52
|
+
(This README supersedes and expands the minimal starter at: )
|
|
53
|
+
|
|
54
|
+
⸻
|
|
55
|
+
|
|
56
|
+
1. Features
|
|
57
|
+
|
|
58
|
+
Meaning-First API Surface
|
|
59
|
+
• Native UMO creation
|
|
60
|
+
• Semantic + hybrid search
|
|
61
|
+
• Timeline querying
|
|
62
|
+
• Graph neighborhood expansion
|
|
63
|
+
• Cluster & drift detection access
|
|
64
|
+
• Agent execution (summaries, insights, narratives)
|
|
65
|
+
|
|
66
|
+
Production-Ready Network Layer
|
|
67
|
+
• Sync + Async clients
|
|
68
|
+
• Automatic retries with exponential backoff
|
|
69
|
+
• Connection pooling
|
|
70
|
+
• Circuit-breaking & timeouts
|
|
71
|
+
• Request tracing (observability)
|
|
72
|
+
• Structured logging helpers
|
|
73
|
+
|
|
74
|
+
Governance + Privacy Enforcement
|
|
75
|
+
• Automatic conversion of external IDs → ULIDs
|
|
76
|
+
• Masking of governed fields
|
|
77
|
+
• Provenance hashing (SHA-256)
|
|
78
|
+
• Tenant isolation
|
|
79
|
+
• No raw identity leakage
|
|
80
|
+
|
|
81
|
+
Developer Ergonomics
|
|
82
|
+
• Type hints
|
|
83
|
+
• Pydantic models
|
|
84
|
+
• Exceptions for precise error handling
|
|
85
|
+
• Response validation
|
|
86
|
+
• Extensible middleware
|
|
87
|
+
|
|
88
|
+
Advanced SDK Extensions
|
|
89
|
+
• Bulk ingestion helpers
|
|
90
|
+
• Batch export helpers
|
|
91
|
+
• Local capture queue (offline-first ingestion)
|
|
92
|
+
• Evaluation tools for embeddings & search quality
|
|
93
|
+
|
|
94
|
+
⸻
|
|
95
|
+
|
|
96
|
+
2. Installation
|
|
97
|
+
|
|
98
|
+
pip install memory-intelligence
|
|
99
|
+
|
|
100
|
+
Or install from source for development:
|
|
101
|
+
|
|
102
|
+
pip install -e .
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
⸻
|
|
106
|
+
|
|
107
|
+
3. Initialization
|
|
108
|
+
|
|
109
|
+
from memory_intelligence import MemoryClient
|
|
110
|
+
|
|
111
|
+
client = MemoryClient(
|
|
112
|
+
api_key="YOUR_API_KEY",
|
|
113
|
+
api_url="https://api.memory-intelligence.com"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
You may also configure via environment variables:
|
|
117
|
+
|
|
118
|
+
MI_API_KEY=...
|
|
119
|
+
MI_API_URL=https://api.memory-intelligence.com
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
⸻
|
|
123
|
+
|
|
124
|
+
4. Core Concepts
|
|
125
|
+
|
|
126
|
+
Unified Memory Objects (UMOs)
|
|
127
|
+
|
|
128
|
+
UMOs are the canonical memory format inside MemoryOS.
|
|
129
|
+
|
|
130
|
+
The SDK automatically validates UMO structure and can create them from:
|
|
131
|
+
• text
|
|
132
|
+
• audio transcription text
|
|
133
|
+
• images (OCR text)
|
|
134
|
+
• URLs (browser captures)
|
|
135
|
+
• JSON capture envelopes
|
|
136
|
+
• Slack/email ingestion payloads
|
|
137
|
+
|
|
138
|
+
The SDK ensures:
|
|
139
|
+
• correct schema
|
|
140
|
+
• correct timestamp formats
|
|
141
|
+
• correct ULID identity boundaries
|
|
142
|
+
• correct provenance hashing
|
|
143
|
+
|
|
144
|
+
⸻
|
|
145
|
+
|
|
146
|
+
5. Creating Memories
|
|
147
|
+
|
|
148
|
+
Simple Text Memory
|
|
149
|
+
|
|
150
|
+
umo = client.memories.create(
|
|
151
|
+
content="Had a meeting about Q2 product roadmap.",
|
|
152
|
+
tags=["meeting", "planning"]
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
With Additional Metadata
|
|
156
|
+
|
|
157
|
+
umo = client.memories.create(
|
|
158
|
+
content="User feedback from onboarding session.",
|
|
159
|
+
context={"channel": "support", "sentiment": "positive"},
|
|
160
|
+
source="manual"
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
With Provenance Hash Override
|
|
164
|
+
|
|
165
|
+
umo = client.memories.create(
|
|
166
|
+
content="Draft article notes.",
|
|
167
|
+
provenance_hash="abc123...", # optional if you compute your own
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
⸻
|
|
172
|
+
|
|
173
|
+
6. Searching Memories
|
|
174
|
+
|
|
175
|
+
Semantic Search
|
|
176
|
+
|
|
177
|
+
results = client.search.semantic("project planning")
|
|
178
|
+
|
|
179
|
+
Hybrid Search (semantic + lexical + temporal)
|
|
180
|
+
|
|
181
|
+
results = client.search.hybrid(
|
|
182
|
+
query="customer retention initiative",
|
|
183
|
+
limit=20,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
Entity-Based Filtering
|
|
187
|
+
|
|
188
|
+
results = client.search.by_entity("OpenAI", limit=10)
|
|
189
|
+
|
|
190
|
+
Graph Neighborhood Expansion
|
|
191
|
+
|
|
192
|
+
neighbors = client.graph.neighbors(umo_id="01F...")
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
⸻
|
|
196
|
+
|
|
197
|
+
7. Timeline Queries
|
|
198
|
+
|
|
199
|
+
timeline = client.timeline.range(
|
|
200
|
+
start="2025-01-01",
|
|
201
|
+
end="2025-02-01",
|
|
202
|
+
sort="chronological"
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
Or retrieve the significance-ranked resurfacing window:
|
|
206
|
+
|
|
207
|
+
resurfaced = client.timeline.resurface(limit=15)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
⸻
|
|
211
|
+
|
|
212
|
+
8. Inspecting UMOs
|
|
213
|
+
|
|
214
|
+
umo = client.memories.get("01H...") # fetch a UMO
|
|
215
|
+
print(umo.meaning.entities) # inspect meaning
|
|
216
|
+
print(umo.provenance.hash) # provenance integrity
|
|
217
|
+
|
|
218
|
+
Diffing UMO Versions
|
|
219
|
+
|
|
220
|
+
diff = client.memories.diff("01H...", version_a=1, version_b=3)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
⸻
|
|
224
|
+
|
|
225
|
+
9. Agents API (Summaries, Insights, Narrative)
|
|
226
|
+
|
|
227
|
+
Generate a summary
|
|
228
|
+
|
|
229
|
+
summary = client.agents.summarize(umo_id="01H...")
|
|
230
|
+
|
|
231
|
+
Generate insights across a collection
|
|
232
|
+
|
|
233
|
+
insights = client.agents.generate_insights(collection_id="col_123")
|
|
234
|
+
|
|
235
|
+
Narrative generation
|
|
236
|
+
|
|
237
|
+
narrative = client.agents.narrative(umo_ids=["01H..", "01H.."])
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
⸻
|
|
241
|
+
|
|
242
|
+
10. Working With Collections
|
|
243
|
+
|
|
244
|
+
col = client.collections.create(name="Research Notes")
|
|
245
|
+
|
|
246
|
+
client.collections.add(
|
|
247
|
+
collection_id=col.id,
|
|
248
|
+
umo_id="01H..."
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
Fetch:
|
|
252
|
+
|
|
253
|
+
items = client.collections.get(col.id)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
⸻
|
|
257
|
+
|
|
258
|
+
11. Async Usage
|
|
259
|
+
|
|
260
|
+
From the original file expanded:
|
|
261
|
+
|
|
262
|
+
import asyncio
|
|
263
|
+
from memory_intelligence import MemoryAsyncClient
|
|
264
|
+
|
|
265
|
+
async def main():
|
|
266
|
+
async with MemoryAsyncClient(api_key="YOUR_KEY") as client:
|
|
267
|
+
results = await client.search.semantic("product planning")
|
|
268
|
+
print(results)
|
|
269
|
+
|
|
270
|
+
asyncio.run(main())
|
|
271
|
+
|
|
272
|
+
Async client supports:
|
|
273
|
+
• connection pooling
|
|
274
|
+
• concurrent searches
|
|
275
|
+
• async streaming (roadmap)
|
|
276
|
+
|
|
277
|
+
⸻
|
|
278
|
+
|
|
279
|
+
12. Bulk & Batch Operations
|
|
280
|
+
|
|
281
|
+
Batch Ingestion
|
|
282
|
+
|
|
283
|
+
batch = [
|
|
284
|
+
{"content": "Interview notes …"},
|
|
285
|
+
{"content": "Email summary …"},
|
|
286
|
+
{"content": "Research excerpt …"},
|
|
287
|
+
]
|
|
288
|
+
|
|
289
|
+
client.bulk.ingest(batch)
|
|
290
|
+
|
|
291
|
+
Batch Export
|
|
292
|
+
|
|
293
|
+
data = client.bulk.export(
|
|
294
|
+
since="2024-01-01",
|
|
295
|
+
include_provenance=True
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
⸻
|
|
300
|
+
|
|
301
|
+
13. Error Handling
|
|
302
|
+
|
|
303
|
+
from memory_intelligence.errors import (
|
|
304
|
+
AuthenticationError,
|
|
305
|
+
ValidationError,
|
|
306
|
+
GovernanceViolation,
|
|
307
|
+
RateLimitExceeded,
|
|
308
|
+
ServerError
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
try:
|
|
312
|
+
client.memories.create(content=None)
|
|
313
|
+
except ValidationError as e:
|
|
314
|
+
print("Invalid memory:", e)
|
|
315
|
+
|
|
316
|
+
Each exception type includes:
|
|
317
|
+
• error code
|
|
318
|
+
• human-friendly message
|
|
319
|
+
• context metadata
|
|
320
|
+
• retry hints (when applicable)
|
|
321
|
+
|
|
322
|
+
⸻
|
|
323
|
+
|
|
324
|
+
14. Observability & Logging
|
|
325
|
+
|
|
326
|
+
Attach middleware:
|
|
327
|
+
|
|
328
|
+
from memory_intelligence.middlewares import LoggingMiddleware
|
|
329
|
+
|
|
330
|
+
client = MemoryClient(
|
|
331
|
+
api_key="...",
|
|
332
|
+
middlewares=[LoggingMiddleware()]
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
Each request emits:
|
|
336
|
+
• trace_id
|
|
337
|
+
• span_id
|
|
338
|
+
• duration_ms
|
|
339
|
+
• HTTP code
|
|
340
|
+
• retry count (if applicable)
|
|
341
|
+
|
|
342
|
+
Compatible with:
|
|
343
|
+
• OpenTelemetry
|
|
344
|
+
• Datadog
|
|
345
|
+
• New Relic
|
|
346
|
+
|
|
347
|
+
⸻
|
|
348
|
+
|
|
349
|
+
15. Governance Compliance in the SDK
|
|
350
|
+
|
|
351
|
+
The SDK automatically:
|
|
352
|
+
• strips forbidden identity fields
|
|
353
|
+
• maps external IDs → ULIDs
|
|
354
|
+
• masks governed entities
|
|
355
|
+
• prevents raw external identifiers from being sent
|
|
356
|
+
• computes SHA-256 provenance hashes
|
|
357
|
+
• prevents accidental schema violations
|
|
358
|
+
|
|
359
|
+
This guarantees MemoryOS receives clean, safe, meaning-aligned data.
|
|
360
|
+
|
|
361
|
+
⸻
|
|
362
|
+
|
|
363
|
+
16. Local Capture Queue (Optional)
|
|
364
|
+
|
|
365
|
+
For offline or burst ingestion:
|
|
366
|
+
|
|
367
|
+
queue = client.capture_queue()
|
|
368
|
+
|
|
369
|
+
queue.enqueue({"content": "Field note"})
|
|
370
|
+
queue.enqueue({"content": "Another note"})
|
|
371
|
+
|
|
372
|
+
queue.flush() # uploads in batches
|
|
373
|
+
|
|
374
|
+
Provides:
|
|
375
|
+
• crash-safe local disk persistence
|
|
376
|
+
• idempotent sync
|
|
377
|
+
• backpressure control
|
|
378
|
+
|
|
379
|
+
⸻
|
|
380
|
+
|
|
381
|
+
17. Development Utilities
|
|
382
|
+
|
|
383
|
+
Validate a UMO
|
|
384
|
+
|
|
385
|
+
from memory_intelligence import validate_umo
|
|
386
|
+
|
|
387
|
+
validate_umo(umo_dict)
|
|
388
|
+
|
|
389
|
+
Encode/Decode ULIDs
|
|
390
|
+
|
|
391
|
+
from memory_intelligence import ULID
|
|
392
|
+
|
|
393
|
+
ulid = ULID.new()
|
|
394
|
+
|
|
395
|
+
Compute a provenance hash
|
|
396
|
+
|
|
397
|
+
from memory_intelligence import compute_hash
|
|
398
|
+
|
|
399
|
+
h = compute_hash("some content")
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
⸻
|
|
403
|
+
|
|
404
|
+
18. Roadmap
|
|
405
|
+
|
|
406
|
+
Upcoming Python SDK features:
|
|
407
|
+
• streaming search results
|
|
408
|
+
• async agent pipelines
|
|
409
|
+
• local meaning snapshot cache
|
|
410
|
+
• automatic retry queues
|
|
411
|
+
• timeline diff utilities
|
|
412
|
+
• embedding evaluation toolkit
|
|
413
|
+
|
|
414
|
+
⸻
|
|
415
|
+
|
|
416
|
+
19. Summary
|
|
417
|
+
|
|
418
|
+
The Memory Intelligence Python SDK is the foundation for:
|
|
419
|
+
• ingestion pipelines
|
|
420
|
+
• application backends
|
|
421
|
+
• research tooling
|
|
422
|
+
• enterprise workflows
|
|
423
|
+
• agent development
|
|
424
|
+
• governance-safe meaning retrieval
|
|
425
|
+
|
|
426
|
+
It abstracts the complexity of MemoryOS, Engines, Identity, Governance, and Platform layers—providing a meaning-first, privacy-first, developer-friendly interface for building the next generation of memory-driven applications.
|
|
427
|
+
|
|
428
|
+
⸻
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
memoryintelligence/__init__.py,sha256=wB3tegxhj0E4xoQYUzt7fehsbUSuuzAbRd3UkrBr6yU,3366
|
|
2
|
+
memoryintelligence/edge_client.py,sha256=gKzGStULSxsViZEP-BUTbKm6N8uIBChyb-vpr_jwZ04,13425
|
|
3
|
+
memoryintelligence/memory_client.py,sha256=ouXIzDlQTUTek8rOJmE45bGWcsnzNPAfsDWerkquSuY,24186
|
|
4
|
+
memoryintelligence/mi_types.py,sha256=LMhvEbep8mROEjeEfMVeK7gG6jH7OKVYdUAiKh6B_yQ,10440
|
|
5
|
+
memoryintelligence-1.0.0.dist-info/licenses/LICENSE,sha256=2mzz0DJdCoNdgUXVcDxIr1o1LMnNdkJEIQj7HSNnsrw,1537
|
|
6
|
+
memoryintelligence-1.0.0.dist-info/METADATA,sha256=LN9cUPlA9NdI-AXqVlhIbS8MN7wgtJD-H2m87baVANQ,9532
|
|
7
|
+
memoryintelligence-1.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
8
|
+
memoryintelligence-1.0.0.dist-info/top_level.txt,sha256=jQxLND_7L23jp0FCpvuTv-Pf9qw64yMBkUsovU1WGpk,19
|
|
9
|
+
memoryintelligence-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
MIT License with Attribution Requirement
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Memory Intelligence
|
|
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
|
+
1. The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
2. Applications using this SDK MUST display "Powered by Memory Intelligence"
|
|
16
|
+
attribution in their user interface or documentation.
|
|
17
|
+
|
|
18
|
+
3. This SDK may only be used to interact with official Memory Intelligence API
|
|
19
|
+
services. No reverse engineering of the API or unauthorized replication of
|
|
20
|
+
the service is permitted.
|
|
21
|
+
|
|
22
|
+
4. API access credentials (API keys) are non-transferable and may not be
|
|
23
|
+
resold or sublicensed.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
memoryintelligence
|