memoryintelligence 0.1.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.
@@ -0,0 +1,242 @@
1
+ # Changelog
2
+
3
+ ## [2.0.1] - 2026-03-27
4
+
5
+ ### Fixed
6
+ - Corrected all documentation and billing URLs from `memoryintelligence.dev` to `memoryintelligence.io`
7
+ - Updated default API base URL from `api.memoryintelligence.dev` to `api.memoryintelligence.io`
8
+ - Resolved dead links in error messages, edge client defaults, and PyPI package metadata
9
+
10
+
11
+ All notable changes to the Memory Intelligence Python SDK.
12
+
13
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
14
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
15
+
16
+ ## [2.0.0] - 2026-02-27
17
+
18
+ ### Breaking Changes
19
+
20
+ #### UMO Namespace Pattern
21
+ - **Changed:** All UMO operations moved to `mi.umo.*` namespace
22
+ - `mi.process()` → `mi.umo.process()`
23
+ - `mi.search()` → `mi.umo.search()`
24
+ - `mi.match()` → `mi.umo.match()`
25
+ - `mi.explain()` → `mi.umo.explain()`
26
+ - `mi.delete()` → `mi.umo.delete()`
27
+
28
+ #### Mandatory Encryption
29
+ - **Changed:** Client-side AES-256-GCM encryption is now **mandatory**
30
+ - **Removed:** `enable_encryption` parameter (previously optional in v1)
31
+ - **Added:** Automatic encryption with ephemeral key if `MI_ENCRYPTION_KEY` not set
32
+ - **Added:** Warning logged when using ephemeral keys in production
33
+
34
+ #### User ID Format
35
+ - **Changed:** `user_id` parameter renamed to `user_ulid`
36
+ - **Changed:** Must use ULID format (26-character string: `01ABC...`)
37
+ - **Migration:** Generate ULIDs: `str(ULID())`
38
+
39
+ #### Dual Identity Pattern
40
+ - **Changed:** `user_ulid` no longer defaults from client constructor
41
+ - **Added:** `for_user(user_ulid)` method for scoped clients
42
+ - **Usage:**
43
+ ```python
44
+ # v2.0
45
+ mi = MemoryClient()
46
+ user_client = mi.for_user("01USER12345678901234567890")
47
+ umo = user_client.umo.process("content")
48
+ ```
49
+
50
+ #### Model Serialization
51
+ - **Changed:** Models converted from dataclasses to Pydantic BaseModel
52
+ - **Changed:** `asdict(umo)` → `umo.model_dump()`
53
+ - **Changed:** `json.dumps(asdict(umo))` → `umo.model_dump_json()`
54
+ - **Added:** Full Pydantic validation and serialization support
55
+
56
+ #### Error Classes
57
+ - **Renamed:** `AuthError` → `AuthenticationError`
58
+ - **Added:** New exception classes:
59
+ - `LicenseError` - License validation and feature gating
60
+ - `PIIViolationError` - PII detection violations (HTTP 451)
61
+ - `PaymentRequiredError` - License required (HTTP 402)
62
+ - `ConflictError` - Resource conflicts (HTTP 409)
63
+
64
+ ### Added
65
+
66
+ #### EdgeClient
67
+ - **Added:** `EdgeClient` for on-premises deployment
68
+ - **Features:**
69
+ - HIPAA mode (`hipaa_mode=True`)
70
+ - Air-gapped deployment (`air_gapped=True`)
71
+ - Federated aggregation (`aggregate()`)
72
+ - PHI handling verification (`verify_phi_handling()`)
73
+ - Audit log export (`export_audit_log()`)
74
+ - **License Required:** ENTERPRISE tier only
75
+
76
+ #### Async Support
77
+ - **Added:** `AsyncMemoryClient` for non-blocking operations
78
+ - **Features:**
79
+ - Full async/await support
80
+ - Connection pooling with `httpx.AsyncClient`
81
+ - Same API as sync client
82
+
83
+ #### License System
84
+ - **Added:** License tier enforcement (TRIAL, STARTER, PROFESSIONAL, ENTERPRISE)
85
+ - **Added:** Feature gating:
86
+ - STARTER: `process()`, `search()` only
87
+ - PROFESSIONAL: All cloud features (`match()`, `explain()`)
88
+ - ENTERPRISE: All features including EdgeClient
89
+ - **Added:** Grace periods:
90
+ - Cloud: 14 days
91
+ - Air-gapped: 30 days
92
+ - **Added:** License caching with 24-hour TTL
93
+ - **Added:** Background license revalidation
94
+
95
+ #### Encryption Enhancements
96
+ - **Added:** AES-256-GCM encryption with PBKDF2 (100,000 iterations)
97
+ - **Added:** User ULID binding via associated data
98
+ - **Added:** Key identification via SHA-256 hash
99
+ - **Added:** `EncryptedPayload` model for inspection
100
+
101
+ #### HTTP Transport
102
+ - **Added:** `SyncTransport` and `AsyncTransport` with retry logic
103
+ - **Added:** Exponential backoff with jitter
104
+ - **Added:** Retry on: 408, 429, 500, 502, 503, 504
105
+ - **Added:** ULID request IDs for tracing
106
+ - **Added:** Automatic error mapping from HTTP status codes
107
+
108
+ #### Models
109
+ - **Added:** Pydantic models for all API responses:
110
+ - `MeaningObject`, `Entity`, `Topic`, `SVOTriple`
111
+ - `SearchResponse`, `SearchResult`, `MatchResult`
112
+ - `Explanation`, `HumanExplanation`, `AuditExplanation`
113
+ - `Provenance`, `PIIInfo`, `DeleteResult`
114
+ - **Added:** Enum types:
115
+ - `Scope` (USER, CLIENT, ORGANIZATION)
116
+ - `PIIHandling` (EXTRACT_AND_REDACT, HASH, REJECT)
117
+ - `RetentionPolicy` (FULL, MEANING_ONLY, NO_STORAGE)
118
+ - `ProvenanceMode` (MINIMAL, STANDARD, AUDIT)
119
+ - `LicenseType` (TRIAL, STARTER, PROFESSIONAL, ENTERPRISE)
120
+ - `LicenseStatus` (ACTIVE, EXPIRED, REVOKED, SUSPENDED)
121
+
122
+ ### Changed
123
+
124
+ #### Dependencies
125
+ - **Added:** `httpx>=0.27.0` (was `requests` in v1)
126
+ - **Added:** `pydantic>=2.5.0`
127
+ - **Added:** `cryptography>=42.0.0`
128
+ - **Added:** `python-ulid>=2.0.0`
129
+ - **Removed:** `requests` dependency
130
+
131
+ #### Configuration
132
+ - **Changed:** `MI_API_KEY` environment variable now the primary auth method
133
+ - **Changed:** `MI_ENCRYPTION_KEY` for persistent encryption keys
134
+ - **Added:** Validation for API key format (`mi_sk_` prefix)
135
+
136
+ #### Error Handling
137
+ - **Changed:** All errors now include `code` attribute
138
+ - **Changed:** `RateLimitError` includes `retry_after` seconds
139
+ - **Changed:** `ServerError` includes `request_id` for debugging
140
+ - **Changed:** `ValidationError` includes `field` for invalid parameters
141
+ - **Changed:** `LicenseError` includes `days_expired` and `renew_url`
142
+
143
+ ### Removed
144
+
145
+ - **Removed:** Direct method calls on `MemoryClient` (use `mi.umo.*`)
146
+ - **Removed:** `enable_encryption` parameter (always enabled)
147
+ - **Removed:** `user_id` parameter (use `user_ulid`)
148
+ - **Removed:** `AuthError` exception (use `AuthenticationError`)
149
+
150
+ ### Security
151
+
152
+ - **Added:** Mandatory client-side encryption for all content
153
+ - **Added:** User ULID binding prevents cross-user decryption
154
+ - **Added:** Authentication tags prevent tampering
155
+ - **Added:** PII detection with configurable handling
156
+ - **Added:** HIPAA mode for healthcare compliance
157
+ - **Added:** Audit logging for compliance reviews
158
+ - **Added:** Scope isolation (user/client/organization)
159
+
160
+ ### Documentation
161
+
162
+ - **Added:** Quickstart guide (`docs/quickstart.md`)
163
+ - **Added:** Authentication guide (`docs/authentication.md`)
164
+ - **Added:** Encryption guide (`docs/encryption.md`)
165
+ - **Added:** Licensing guide (`docs/licensing.md`)
166
+ - **Added:** API reference (`docs/api_reference.md`)
167
+ - **Added:** Enterprise guide (`docs/enterprise.md`)
168
+ - **Added:** Migration guide (`docs/migration_v1_to_v2.md`)
169
+ - **Added:** FAQ (`docs/faq.md`)
170
+ - **Added:** OpenAPI specification (`docs/openapi.yaml`)
171
+
172
+ ### Testing
173
+
174
+ - **Added:** Comprehensive test suite:
175
+ - `tests/test_client.py` - UMONamespace methods
176
+ - `tests/test_crypto.py` - Encryption/decryption
177
+ - `tests/test_license.py` - License validation
178
+ - `tests/test_edge_client.py` - EdgeClient functionality
179
+ - `tests/test_errors.py` - HTTP status mapping
180
+ - `tests/test_integration.py` - End-to-end workflows
181
+ - **Added:** pytest fixtures with mocked transport
182
+ - **Added:** Test coverage for all license tiers
183
+
184
+ ---
185
+
186
+ ## [1.0.1] - 2026-02-07
187
+
188
+ ### Fixed
189
+ - Corrected `ProvenanceError` in `__all__` exports list (final typo fix)
190
+
191
+ ## [1.0.0] - 2026-02-07 [YANKED]
192
+
193
+ ### Added
194
+ - **MemoryClient** with 6 core operations: process, search, match, explain, delete, verify_provenance
195
+ - **EdgeClient** for on-premises HIPAA-compliant deployments
196
+ - Privacy-first architecture with meaning-only retention (default)
197
+ - Structured semantic extraction (entities, topics, SVO triples, key phrases)
198
+ - Explainable search results with human + audit explanations
199
+ - Cryptographic provenance tracking with hash chain verification
200
+ - ULID-based identity firewall for cryptographic tenant isolation
201
+ - Scope-based access control (user, team, client, organization)
202
+ - PII detection and configurable handling (extract_and_redact, hash, reject)
203
+ - Type-safe API with Pydantic models
204
+ - Comprehensive error handling (7 exception types)
205
+ - 30+ unit and integration tests
206
+
207
+ ### Known Limitations
208
+ - Pagination not yet implemented (coming in v1.1.0)
209
+ - Streaming search results not yet available
210
+ - Temporal intelligence parameter present but not fully validated in tests
211
+
212
+ ### Fixed
213
+ - Corrected `ProvenanceError` exception name (was misspelled as `ProvenenaceError`)
214
+
215
+ ---
216
+
217
+ ## Migration Guide
218
+
219
+ See [docs/migration_v1_to_v2.md](docs/migration_v1_to_v2.md) for detailed migration instructions.
220
+
221
+ ### Quick Migration Checklist
222
+
223
+ - [ ] Update imports to use `mi.umo.*` namespace
224
+ - [ ] Rename `user_id` to `user_ulid` (use ULID format)
225
+ - [ ] Set `MI_ENCRYPTION_KEY` environment variable
226
+ - [ ] Update `asdict(umo)` to `umo.model_dump()`
227
+ - [ ] Rename `AuthError` to `AuthenticationError`
228
+ - [ ] Use `for_user()` for multi-user applications
229
+
230
+ ---
231
+
232
+ ## Support
233
+
234
+ - **Documentation:** [docs.memoryintelligence.dev](https://docs.memoryintelligence.dev)
235
+ - **Migration Help:** migration@memoryintelligence.dev
236
+ - **Issues:** [github.com/memoryintelligence/sdk-python/issues](https://github.com/memoryintelligence/sdk-python/issues)
237
+ - **Changelog:** This file
238
+
239
+ [2.0.0]: https://github.com/memoryintelligence/sdk-python/releases/tag/v2.0.0
240
+ [1.0.1]: https://github.com/memoryintelligence/sdk-python/releases/tag/v1.0.1
241
+ [1.0.0]: https://github.com/memoryintelligence/sdk-python/releases/tag/v1.0.0
242
+ [Unreleased]: https://github.com/memoryintelligence/sdk-python/compare/v2.0.0...HEAD
@@ -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,21 @@
1
+ # Include essential files
2
+ include README.md
3
+ include LICENSE
4
+ include CHANGELOG.md
5
+
6
+ # Include package data
7
+ recursive-include memoryintelligence *.py
8
+
9
+ # Exclude development files
10
+ exclude .gitignore
11
+ exclude .env*
12
+ recursive-exclude tests *
13
+ recursive-exclude demos *
14
+ recursive-exclude examples *
15
+ recursive-exclude .venv *
16
+ recursive-exclude __pycache__ *
17
+ recursive-exclude *.egg-info *
18
+ global-exclude *.pyc
19
+ global-exclude *.pyo
20
+ global-exclude *~
21
+ global-exclude .DS_Store
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: memoryintelligence
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for Memory Intelligence. Structured, verifiable memory for AI.
5
+ Author-email: Memory Intelligence Team <sdk@memoryintelligence.io>
6
+ License: MIT
7
+ Project-URL: Homepage, https://memoryintelligence.io
8
+ Project-URL: Documentation, https://docs.memoryintelligence.io
9
+ Project-URL: Repository, https://github.com/somewhere11/memoryintelligence-python-sdk
10
+ Project-URL: Changelog, https://github.com/somewhere11/memoryintelligence-python-sdk/blob/main/CHANGELOG.md
11
+ Keywords: ai,llm,memory,rag,embeddings,privacy,compliance,hipaa,gdpr,provenance,umo
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: httpx>=0.27.0
24
+ Requires-Dist: python-ulid>=2.0.0
25
+ Provides-Extra: dotenv
26
+ Requires-Dist: python-dotenv>=1.0.0; extra == "dotenv"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=8.0; extra == "dev"
29
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
30
+ Requires-Dist: pytest-httpx>=0.30; extra == "dev"
31
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
32
+ Requires-Dist: mypy>=1.8; extra == "dev"
33
+ Requires-Dist: ruff>=0.3; extra == "dev"
34
+ Requires-Dist: python-dotenv>=1.0.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # Memory Intelligence API
38
+
39
+ **Memory without meaning is just storage.**
40
+
41
+ This API turns raw content (text, conversations, images) into structured meaning. Searchable, explainable, provenance-tracked. No black box. No hallucinations.
42
+
43
+ **For Python backends:** FastAPI, Django, Flask, Lambda, Cloud Functions.
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install memoryintelligence
51
+ ```
52
+
53
+ **Get your API key:** [memoryintelligence.io/beta](https://memoryintelligence.io/beta)
54
+
55
+ ---
56
+
57
+ ## Quick Start
58
+
59
+ ```python
60
+ from memoryintelligence import MemoryIntelligence
61
+
62
+ mi = MemoryIntelligence.from_env() # reads MI_API_KEY
63
+
64
+ # Turn content into a structured, verifiable memory
65
+ note = mi.capture(
66
+ "Discussed pricing with ACME. They prefer quarterly billing.",
67
+ source="sales_call",
68
+ )
69
+
70
+ # Ask by meaning, not keywords
71
+ for hit in mi.ask("what did ACME say about billing?"):
72
+ print(f"{hit.score:.2f} {hit.summary}")
73
+
74
+ # Every memory has a receipt
75
+ if mi.verify(note.id):
76
+ print("intact")
77
+ ```
78
+
79
+ > **Upgrading from `MemoryClient`?** The flat `MemoryIntelligence` client above is
80
+ > the recommended surface. The older `MemoryClient` (the `mi.umo.*` namespace, with
81
+ > multi-tenant `user_ulid`) still works for advanced use, and `EdgeClient` still
82
+ > serves regulated on-premise deployments, but `MemoryClient` is deprecated and will
83
+ > be removed in a future major. See [Core Operations](#core-operations) for the full
84
+ > eight-verb surface.
85
+
86
+ ---
87
+
88
+ ## What It Does
89
+
90
+ - **Processes** → Extracts entities, topics, relationships, sentiment
91
+ - **Searches** → Returns ranked results with explainability
92
+ - **Matches** → Compares memories for relevance/similarity
93
+ - **Explains** → Shows *why* results matched (semantic, temporal, graph)
94
+ - **Deletes** → GDPR-compliant data removal with audit trail
95
+
96
+ **No vector database setup. No chunking strategies. No embedding models to manage.**
97
+
98
+ ---
99
+
100
+ ## Security: API Keys Are Server-Only
101
+
102
+ Your API key grants full account access. Keep it server-side.
103
+
104
+ **✅ Backend (environment variable):**
105
+ ```python
106
+ mi = MemoryIntelligence.from_env() # reads MI_API_KEY
107
+ ```
108
+
109
+ **❌ Never hardcoded:**
110
+ ```python
111
+ # Don't - visible in logs/code
112
+ mi = MemoryIntelligence(api_key='mi_sk_live_...')
113
+ ```
114
+
115
+ **For web apps:** Use your API key in the backend, build your own endpoints with your auth, let your frontend call those.
116
+
117
+ ---
118
+
119
+ ## What Makes This Different
120
+
121
+ | Others | Memory Intelligence |
122
+ |--------|---------------------|
123
+ | Store text, embed, hope | Extract meaning first |
124
+ | "Here are similar chunks" | "Here's why this matched" |
125
+ | No audit trail | Cryptographic provenance |
126
+ | Your data = their model training | We never train on your data |
127
+
128
+ **Setting the standard for memory.**
129
+
130
+ ---
131
+
132
+ ## Core Operations
133
+
134
+ Eight verbs, mapped one-to-one onto the public API:
135
+
136
+ ```python
137
+ note = mi.capture(content, source="notes") # POST /v1/process
138
+ hits = mi.ask(query, limit=5) # POST /v1/memories/query
139
+ note = mi.get(umo_id) # GET /v1/memories/{id}
140
+ notes = mi.list(limit=20) # GET /v1/memories
141
+ proof = mi.verify(umo_id) # GET /v1/memories/{id}/proof
142
+ why = mi.explain(umo_id) # GET /v1/memories/{id}/explain
143
+ receipt = mi.forget(umo_id) # DELETE /v1/memories/{id}
144
+ notes = mi.batch(["note one", "note two"]) # POST /v1/batch
145
+ note = mi.upload("meeting.mp3") # POST /v1/upload
146
+ ```
147
+
148
+ Results come back as small typed objects (`Memory`, `Match`, `Proof`, `Receipt`),
149
+ each with a `.raw` escape hatch and item access, so `note.id` when it is clean and
150
+ `note["quality_score"]` when you need a field we did not surface.
151
+
152
+ ---
153
+
154
+ ## Async Support
155
+
156
+ An async twin of the flat client (`AsyncMemoryIntelligence`) is on the roadmap.
157
+ Until then, the async surface is the older `AsyncMemoryClient` (the `mi.umo.*`
158
+ namespace, deprecated alongside `MemoryClient`):
159
+
160
+ ```python
161
+ from memoryintelligence import AsyncMemoryClient
162
+
163
+ async with AsyncMemoryClient.from_env() as mi:
164
+ results = await mi.umo.search(query, user_ulid="01ABC...")
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Error Handling
170
+
171
+ ```python
172
+ from memoryintelligence import (
173
+ MIError, AuthenticationError, NotFoundError, RateLimitError, ValidationError,
174
+ )
175
+
176
+ try:
177
+ hits = mi.ask(query)
178
+ except AuthenticationError:
179
+ ... # API key invalid or expired
180
+ except NotFoundError:
181
+ ... # no memory with that id
182
+ except RateLimitError:
183
+ ... # the client already retried with backoff
184
+ except ValidationError as e:
185
+ ... # request shape was wrong
186
+ except MIError as e:
187
+ print(e.status, e) # any API error carries its status
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Typed Everywhere
193
+
194
+ Full Pydantic models. Type hints on every method. No `dict` soup.
195
+
196
+ ```python
197
+ from memoryintelligence import Memory, Match, Proof
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Examples & Docs
203
+
204
+ - **[Getting Started Guide](https://github.com/memoryintelligence/memoryintelligence-python-sdk/tree/main/docs/GETTING-STARTED.md)** — Full walkthrough
205
+ - **[FastAPI Integration](https://github.com/memoryintelligence/memoryintelligence-python-sdk/tree/main/examples/fastapi_app.py)** — Complete example
206
+ - **[Advanced Usage](https://github.com/memoryintelligence/memoryintelligence-python-sdk/tree/main/docs/ADVANCED.md)** — Batch processing, retry logic, custom configs
207
+
208
+ ---
209
+
210
+ ## Support
211
+
212
+ - **Docs:** [memoryintelligence.io/docs](https://memoryintelligence.io/docs)
213
+ - **Issues:** [github.com/memoryintelligence/memoryintelligence-python-sdk/issues](https://github.com/memoryintelligence/memoryintelligence-python-sdk/issues)
214
+ - **Beta:** [memoryintelligence.io/beta](https://memoryintelligence.io/beta)
215
+
216
+ ---
217
+
218
+ **Memory Intelligence™** — Setting the standard for memory.
219
+
220
+ Built by [somewhere](https://somewheremedia.com)
@@ -0,0 +1,184 @@
1
+ # Memory Intelligence API
2
+
3
+ **Memory without meaning is just storage.**
4
+
5
+ This API turns raw content (text, conversations, images) into structured meaning. Searchable, explainable, provenance-tracked. No black box. No hallucinations.
6
+
7
+ **For Python backends:** FastAPI, Django, Flask, Lambda, Cloud Functions.
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pip install memoryintelligence
15
+ ```
16
+
17
+ **Get your API key:** [memoryintelligence.io/beta](https://memoryintelligence.io/beta)
18
+
19
+ ---
20
+
21
+ ## Quick Start
22
+
23
+ ```python
24
+ from memoryintelligence import MemoryIntelligence
25
+
26
+ mi = MemoryIntelligence.from_env() # reads MI_API_KEY
27
+
28
+ # Turn content into a structured, verifiable memory
29
+ note = mi.capture(
30
+ "Discussed pricing with ACME. They prefer quarterly billing.",
31
+ source="sales_call",
32
+ )
33
+
34
+ # Ask by meaning, not keywords
35
+ for hit in mi.ask("what did ACME say about billing?"):
36
+ print(f"{hit.score:.2f} {hit.summary}")
37
+
38
+ # Every memory has a receipt
39
+ if mi.verify(note.id):
40
+ print("intact")
41
+ ```
42
+
43
+ > **Upgrading from `MemoryClient`?** The flat `MemoryIntelligence` client above is
44
+ > the recommended surface. The older `MemoryClient` (the `mi.umo.*` namespace, with
45
+ > multi-tenant `user_ulid`) still works for advanced use, and `EdgeClient` still
46
+ > serves regulated on-premise deployments, but `MemoryClient` is deprecated and will
47
+ > be removed in a future major. See [Core Operations](#core-operations) for the full
48
+ > eight-verb surface.
49
+
50
+ ---
51
+
52
+ ## What It Does
53
+
54
+ - **Processes** → Extracts entities, topics, relationships, sentiment
55
+ - **Searches** → Returns ranked results with explainability
56
+ - **Matches** → Compares memories for relevance/similarity
57
+ - **Explains** → Shows *why* results matched (semantic, temporal, graph)
58
+ - **Deletes** → GDPR-compliant data removal with audit trail
59
+
60
+ **No vector database setup. No chunking strategies. No embedding models to manage.**
61
+
62
+ ---
63
+
64
+ ## Security: API Keys Are Server-Only
65
+
66
+ Your API key grants full account access. Keep it server-side.
67
+
68
+ **✅ Backend (environment variable):**
69
+ ```python
70
+ mi = MemoryIntelligence.from_env() # reads MI_API_KEY
71
+ ```
72
+
73
+ **❌ Never hardcoded:**
74
+ ```python
75
+ # Don't - visible in logs/code
76
+ mi = MemoryIntelligence(api_key='mi_sk_live_...')
77
+ ```
78
+
79
+ **For web apps:** Use your API key in the backend, build your own endpoints with your auth, let your frontend call those.
80
+
81
+ ---
82
+
83
+ ## What Makes This Different
84
+
85
+ | Others | Memory Intelligence |
86
+ |--------|---------------------|
87
+ | Store text, embed, hope | Extract meaning first |
88
+ | "Here are similar chunks" | "Here's why this matched" |
89
+ | No audit trail | Cryptographic provenance |
90
+ | Your data = their model training | We never train on your data |
91
+
92
+ **Setting the standard for memory.**
93
+
94
+ ---
95
+
96
+ ## Core Operations
97
+
98
+ Eight verbs, mapped one-to-one onto the public API:
99
+
100
+ ```python
101
+ note = mi.capture(content, source="notes") # POST /v1/process
102
+ hits = mi.ask(query, limit=5) # POST /v1/memories/query
103
+ note = mi.get(umo_id) # GET /v1/memories/{id}
104
+ notes = mi.list(limit=20) # GET /v1/memories
105
+ proof = mi.verify(umo_id) # GET /v1/memories/{id}/proof
106
+ why = mi.explain(umo_id) # GET /v1/memories/{id}/explain
107
+ receipt = mi.forget(umo_id) # DELETE /v1/memories/{id}
108
+ notes = mi.batch(["note one", "note two"]) # POST /v1/batch
109
+ note = mi.upload("meeting.mp3") # POST /v1/upload
110
+ ```
111
+
112
+ Results come back as small typed objects (`Memory`, `Match`, `Proof`, `Receipt`),
113
+ each with a `.raw` escape hatch and item access, so `note.id` when it is clean and
114
+ `note["quality_score"]` when you need a field we did not surface.
115
+
116
+ ---
117
+
118
+ ## Async Support
119
+
120
+ An async twin of the flat client (`AsyncMemoryIntelligence`) is on the roadmap.
121
+ Until then, the async surface is the older `AsyncMemoryClient` (the `mi.umo.*`
122
+ namespace, deprecated alongside `MemoryClient`):
123
+
124
+ ```python
125
+ from memoryintelligence import AsyncMemoryClient
126
+
127
+ async with AsyncMemoryClient.from_env() as mi:
128
+ results = await mi.umo.search(query, user_ulid="01ABC...")
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Error Handling
134
+
135
+ ```python
136
+ from memoryintelligence import (
137
+ MIError, AuthenticationError, NotFoundError, RateLimitError, ValidationError,
138
+ )
139
+
140
+ try:
141
+ hits = mi.ask(query)
142
+ except AuthenticationError:
143
+ ... # API key invalid or expired
144
+ except NotFoundError:
145
+ ... # no memory with that id
146
+ except RateLimitError:
147
+ ... # the client already retried with backoff
148
+ except ValidationError as e:
149
+ ... # request shape was wrong
150
+ except MIError as e:
151
+ print(e.status, e) # any API error carries its status
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Typed Everywhere
157
+
158
+ Full Pydantic models. Type hints on every method. No `dict` soup.
159
+
160
+ ```python
161
+ from memoryintelligence import Memory, Match, Proof
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Examples & Docs
167
+
168
+ - **[Getting Started Guide](https://github.com/memoryintelligence/memoryintelligence-python-sdk/tree/main/docs/GETTING-STARTED.md)** — Full walkthrough
169
+ - **[FastAPI Integration](https://github.com/memoryintelligence/memoryintelligence-python-sdk/tree/main/examples/fastapi_app.py)** — Complete example
170
+ - **[Advanced Usage](https://github.com/memoryintelligence/memoryintelligence-python-sdk/tree/main/docs/ADVANCED.md)** — Batch processing, retry logic, custom configs
171
+
172
+ ---
173
+
174
+ ## Support
175
+
176
+ - **Docs:** [memoryintelligence.io/docs](https://memoryintelligence.io/docs)
177
+ - **Issues:** [github.com/memoryintelligence/memoryintelligence-python-sdk/issues](https://github.com/memoryintelligence/memoryintelligence-python-sdk/issues)
178
+ - **Beta:** [memoryintelligence.io/beta](https://memoryintelligence.io/beta)
179
+
180
+ ---
181
+
182
+ **Memory Intelligence™** — Setting the standard for memory.
183
+
184
+ Built by [somewhere](https://somewheremedia.com)