memoryintelligence 1.0.1__tar.gz → 2.0.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.
Files changed (28) hide show
  1. memoryintelligence-2.0.0/CHANGELOG.md +234 -0
  2. memoryintelligence-2.0.0/PKG-INFO +317 -0
  3. memoryintelligence-2.0.0/README.md +282 -0
  4. memoryintelligence-2.0.0/memoryintelligence/__init__.py +205 -0
  5. memoryintelligence-2.0.0/memoryintelligence/_async_client.py +599 -0
  6. memoryintelligence-2.0.0/memoryintelligence/_auth.py +305 -0
  7. memoryintelligence-2.0.0/memoryintelligence/_client.py +972 -0
  8. memoryintelligence-2.0.0/memoryintelligence/_crypto.py +414 -0
  9. memoryintelligence-2.0.0/memoryintelligence/_edge_client.py +362 -0
  10. memoryintelligence-2.0.0/memoryintelligence/_errors.py +232 -0
  11. memoryintelligence-2.0.0/memoryintelligence/_http.py +400 -0
  12. memoryintelligence-2.0.0/memoryintelligence/_license.py +543 -0
  13. memoryintelligence-1.0.1/memoryintelligence/mi_types.py → memoryintelligence-2.0.0/memoryintelligence/_models.py +154 -185
  14. memoryintelligence-2.0.0/memoryintelligence/_utils.py +386 -0
  15. memoryintelligence-2.0.0/memoryintelligence/_version.py +3 -0
  16. memoryintelligence-2.0.0/memoryintelligence/py.typed +2 -0
  17. memoryintelligence-2.0.0/memoryintelligence.egg-info/SOURCES.txt +18 -0
  18. {memoryintelligence-1.0.1 → memoryintelligence-2.0.0}/pyproject.toml +22 -39
  19. memoryintelligence-1.0.1/CHANGELOG.md +0 -52
  20. memoryintelligence-1.0.1/PKG-INFO +0 -183
  21. memoryintelligence-1.0.1/README.md +0 -148
  22. memoryintelligence-1.0.1/memoryintelligence/__init__.py +0 -152
  23. memoryintelligence-1.0.1/memoryintelligence/edge_client.py +0 -384
  24. memoryintelligence-1.0.1/memoryintelligence/memory_client.py +0 -690
  25. memoryintelligence-1.0.1/memoryintelligence.egg-info/SOURCES.txt +0 -9
  26. {memoryintelligence-1.0.1 → memoryintelligence-2.0.0}/LICENSE +0 -0
  27. {memoryintelligence-1.0.1 → memoryintelligence-2.0.0}/MANIFEST.in +0 -0
  28. {memoryintelligence-1.0.1 → memoryintelligence-2.0.0}/setup.cfg +0 -0
@@ -0,0 +1,234 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Memory Intelligence Python SDK.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.0] - 2026-02-27
9
+
10
+ ### Breaking Changes
11
+
12
+ #### UMO Namespace Pattern
13
+ - **Changed:** All UMO operations moved to `mi.umo.*` namespace
14
+ - `mi.process()` → `mi.umo.process()`
15
+ - `mi.search()` → `mi.umo.search()`
16
+ - `mi.match()` → `mi.umo.match()`
17
+ - `mi.explain()` → `mi.umo.explain()`
18
+ - `mi.delete()` → `mi.umo.delete()`
19
+
20
+ #### Mandatory Encryption
21
+ - **Changed:** Client-side AES-256-GCM encryption is now **mandatory**
22
+ - **Removed:** `enable_encryption` parameter (previously optional in v1)
23
+ - **Added:** Automatic encryption with ephemeral key if `MI_ENCRYPTION_KEY` not set
24
+ - **Added:** Warning logged when using ephemeral keys in production
25
+
26
+ #### User ID Format
27
+ - **Changed:** `user_id` parameter renamed to `user_ulid`
28
+ - **Changed:** Must use ULID format (26-character string: `01ABC...`)
29
+ - **Migration:** Generate ULIDs: `str(ULID())`
30
+
31
+ #### Dual Identity Pattern
32
+ - **Changed:** `user_ulid` no longer defaults from client constructor
33
+ - **Added:** `for_user(user_ulid)` method for scoped clients
34
+ - **Usage:**
35
+ ```python
36
+ # v2.0
37
+ mi = MemoryClient()
38
+ user_client = mi.for_user("01USER12345678901234567890")
39
+ umo = user_client.umo.process("content")
40
+ ```
41
+
42
+ #### Model Serialization
43
+ - **Changed:** Models converted from dataclasses to Pydantic BaseModel
44
+ - **Changed:** `asdict(umo)` → `umo.model_dump()`
45
+ - **Changed:** `json.dumps(asdict(umo))` → `umo.model_dump_json()`
46
+ - **Added:** Full Pydantic validation and serialization support
47
+
48
+ #### Error Classes
49
+ - **Renamed:** `AuthError` → `AuthenticationError`
50
+ - **Added:** New exception classes:
51
+ - `LicenseError` - License validation and feature gating
52
+ - `PIIViolationError` - PII detection violations (HTTP 451)
53
+ - `PaymentRequiredError` - License required (HTTP 402)
54
+ - `ConflictError` - Resource conflicts (HTTP 409)
55
+
56
+ ### Added
57
+
58
+ #### EdgeClient
59
+ - **Added:** `EdgeClient` for on-premises deployment
60
+ - **Features:**
61
+ - HIPAA mode (`hipaa_mode=True`)
62
+ - Air-gapped deployment (`air_gapped=True`)
63
+ - Federated aggregation (`aggregate()`)
64
+ - PHI handling verification (`verify_phi_handling()`)
65
+ - Audit log export (`export_audit_log()`)
66
+ - **License Required:** ENTERPRISE tier only
67
+
68
+ #### Async Support
69
+ - **Added:** `AsyncMemoryClient` for non-blocking operations
70
+ - **Features:**
71
+ - Full async/await support
72
+ - Connection pooling with `httpx.AsyncClient`
73
+ - Same API as sync client
74
+
75
+ #### License System
76
+ - **Added:** License tier enforcement (TRIAL, STARTER, PROFESSIONAL, ENTERPRISE)
77
+ - **Added:** Feature gating:
78
+ - STARTER: `process()`, `search()` only
79
+ - PROFESSIONAL: All cloud features (`match()`, `explain()`)
80
+ - ENTERPRISE: All features including EdgeClient
81
+ - **Added:** Grace periods:
82
+ - Cloud: 14 days
83
+ - Air-gapped: 30 days
84
+ - **Added:** License caching with 24-hour TTL
85
+ - **Added:** Background license revalidation
86
+
87
+ #### Encryption Enhancements
88
+ - **Added:** AES-256-GCM encryption with PBKDF2 (100,000 iterations)
89
+ - **Added:** User ULID binding via associated data
90
+ - **Added:** Key identification via SHA-256 hash
91
+ - **Added:** `EncryptedPayload` model for inspection
92
+
93
+ #### HTTP Transport
94
+ - **Added:** `SyncTransport` and `AsyncTransport` with retry logic
95
+ - **Added:** Exponential backoff with jitter
96
+ - **Added:** Retry on: 408, 429, 500, 502, 503, 504
97
+ - **Added:** ULID request IDs for tracing
98
+ - **Added:** Automatic error mapping from HTTP status codes
99
+
100
+ #### Models
101
+ - **Added:** Pydantic models for all API responses:
102
+ - `MeaningObject`, `Entity`, `Topic`, `SVOTriple`
103
+ - `SearchResponse`, `SearchResult`, `MatchResult`
104
+ - `Explanation`, `HumanExplanation`, `AuditExplanation`
105
+ - `Provenance`, `PIIInfo`, `DeleteResult`
106
+ - **Added:** Enum types:
107
+ - `Scope` (USER, CLIENT, ORGANIZATION)
108
+ - `PIIHandling` (EXTRACT_AND_REDACT, HASH, REJECT)
109
+ - `RetentionPolicy` (FULL, MEANING_ONLY, NO_STORAGE)
110
+ - `ProvenanceMode` (MINIMAL, STANDARD, AUDIT)
111
+ - `LicenseType` (TRIAL, STARTER, PROFESSIONAL, ENTERPRISE)
112
+ - `LicenseStatus` (ACTIVE, EXPIRED, REVOKED, SUSPENDED)
113
+
114
+ ### Changed
115
+
116
+ #### Dependencies
117
+ - **Added:** `httpx>=0.27.0` (was `requests` in v1)
118
+ - **Added:** `pydantic>=2.5.0`
119
+ - **Added:** `cryptography>=42.0.0`
120
+ - **Added:** `python-ulid>=2.0.0`
121
+ - **Removed:** `requests` dependency
122
+
123
+ #### Configuration
124
+ - **Changed:** `MI_API_KEY` environment variable now the primary auth method
125
+ - **Changed:** `MI_ENCRYPTION_KEY` for persistent encryption keys
126
+ - **Added:** Validation for API key format (`mi_sk_` prefix)
127
+
128
+ #### Error Handling
129
+ - **Changed:** All errors now include `code` attribute
130
+ - **Changed:** `RateLimitError` includes `retry_after` seconds
131
+ - **Changed:** `ServerError` includes `request_id` for debugging
132
+ - **Changed:** `ValidationError` includes `field` for invalid parameters
133
+ - **Changed:** `LicenseError` includes `days_expired` and `renew_url`
134
+
135
+ ### Removed
136
+
137
+ - **Removed:** Direct method calls on `MemoryClient` (use `mi.umo.*`)
138
+ - **Removed:** `enable_encryption` parameter (always enabled)
139
+ - **Removed:** `user_id` parameter (use `user_ulid`)
140
+ - **Removed:** `AuthError` exception (use `AuthenticationError`)
141
+
142
+ ### Security
143
+
144
+ - **Added:** Mandatory client-side encryption for all content
145
+ - **Added:** User ULID binding prevents cross-user decryption
146
+ - **Added:** Authentication tags prevent tampering
147
+ - **Added:** PII detection with configurable handling
148
+ - **Added:** HIPAA mode for healthcare compliance
149
+ - **Added:** Audit logging for compliance reviews
150
+ - **Added:** Scope isolation (user/client/organization)
151
+
152
+ ### Documentation
153
+
154
+ - **Added:** Quickstart guide (`docs/quickstart.md`)
155
+ - **Added:** Authentication guide (`docs/authentication.md`)
156
+ - **Added:** Encryption guide (`docs/encryption.md`)
157
+ - **Added:** Licensing guide (`docs/licensing.md`)
158
+ - **Added:** API reference (`docs/api_reference.md`)
159
+ - **Added:** Enterprise guide (`docs/enterprise.md`)
160
+ - **Added:** Migration guide (`docs/migration_v1_to_v2.md`)
161
+ - **Added:** FAQ (`docs/faq.md`)
162
+ - **Added:** OpenAPI specification (`docs/openapi.yaml`)
163
+
164
+ ### Testing
165
+
166
+ - **Added:** Comprehensive test suite:
167
+ - `tests/test_client.py` - UMONamespace methods
168
+ - `tests/test_crypto.py` - Encryption/decryption
169
+ - `tests/test_license.py` - License validation
170
+ - `tests/test_edge_client.py` - EdgeClient functionality
171
+ - `tests/test_errors.py` - HTTP status mapping
172
+ - `tests/test_integration.py` - End-to-end workflows
173
+ - **Added:** pytest fixtures with mocked transport
174
+ - **Added:** Test coverage for all license tiers
175
+
176
+ ---
177
+
178
+ ## [1.0.1] - 2026-02-07
179
+
180
+ ### Fixed
181
+ - Corrected `ProvenanceError` in `__all__` exports list (final typo fix)
182
+
183
+ ## [1.0.0] - 2026-02-07 [YANKED]
184
+
185
+ ### Added
186
+ - **MemoryClient** with 6 core operations: process, search, match, explain, delete, verify_provenance
187
+ - **EdgeClient** for on-premises HIPAA-compliant deployments
188
+ - Privacy-first architecture with meaning-only retention (default)
189
+ - Structured semantic extraction (entities, topics, SVO triples, key phrases)
190
+ - Explainable search results with human + audit explanations
191
+ - Cryptographic provenance tracking with hash chain verification
192
+ - ULID-based identity firewall for cryptographic tenant isolation
193
+ - Scope-based access control (user, team, client, organization)
194
+ - PII detection and configurable handling (extract_and_redact, hash, reject)
195
+ - Type-safe API with Pydantic models
196
+ - Comprehensive error handling (7 exception types)
197
+ - 30+ unit and integration tests
198
+
199
+ ### Known Limitations
200
+ - Pagination not yet implemented (coming in v1.1.0)
201
+ - Streaming search results not yet available
202
+ - Temporal intelligence parameter present but not fully validated in tests
203
+
204
+ ### Fixed
205
+ - Corrected `ProvenanceError` exception name (was misspelled as `ProvenenaceError`)
206
+
207
+ ---
208
+
209
+ ## Migration Guide
210
+
211
+ See [docs/migration_v1_to_v2.md](docs/migration_v1_to_v2.md) for detailed migration instructions.
212
+
213
+ ### Quick Migration Checklist
214
+
215
+ - [ ] Update imports to use `mi.umo.*` namespace
216
+ - [ ] Rename `user_id` to `user_ulid` (use ULID format)
217
+ - [ ] Set `MI_ENCRYPTION_KEY` environment variable
218
+ - [ ] Update `asdict(umo)` to `umo.model_dump()`
219
+ - [ ] Rename `AuthError` to `AuthenticationError`
220
+ - [ ] Use `for_user()` for multi-user applications
221
+
222
+ ---
223
+
224
+ ## Support
225
+
226
+ - **Documentation:** [docs.memoryintelligence.dev](https://docs.memoryintelligence.dev)
227
+ - **Migration Help:** migration@memoryintelligence.dev
228
+ - **Issues:** [github.com/memoryintelligence/sdk-python/issues](https://github.com/memoryintelligence/sdk-python/issues)
229
+ - **Changelog:** This file
230
+
231
+ [2.0.0]: https://github.com/memoryintelligence/sdk-python/releases/tag/v2.0.0
232
+ [1.0.1]: https://github.com/memoryintelligence/sdk-python/releases/tag/v1.0.1
233
+ [1.0.0]: https://github.com/memoryintelligence/sdk-python/releases/tag/v1.0.0
234
+ [Unreleased]: https://github.com/memoryintelligence/sdk-python/compare/v2.0.0...HEAD
@@ -0,0 +1,317 @@
1
+ Metadata-Version: 2.4
2
+ Name: memoryintelligence
3
+ Version: 2.0.0
4
+ Summary: Official Python SDK for Memory Intelligence — Verifiable meaning infrastructure
5
+ Author-email: Memory Intelligence Team <sdk@memoryintelligence.dev>
6
+ License: MIT
7
+ Project-URL: Homepage, https://memoryintelligence.dev
8
+ Project-URL: Documentation, https://docs.memoryintelligence.dev
9
+ Project-URL: Repository, https://github.com/memoryintelligence/sdk-python
10
+ Project-URL: Changelog, https://github.com/memoryintelligence/sdk-python/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: pydantic>=2.5.0
25
+ Requires-Dist: cryptography>=42.0.0
26
+ Requires-Dist: python-ulid>=2.0.0
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
+ Dynamic: license-file
35
+
36
+ # Memory Intelligence SDK
37
+
38
+ The official Python SDK for Memory Intelligence - Verifiable meaning infrastructure for AI.
39
+
40
+ [![PyPI](https://img.shields.io/pypi/v/memoryintelligence.svg)](https://pypi.org/project/memoryintelligence/)
41
+ [![License](https://img.shields.io/pypi/l/memoryintelligence.svg)](https://pypi.org/project/memoryintelligence/)
42
+
43
+ ## Quick Start
44
+
45
+ ```python
46
+ from memoryintelligence import MemoryClient
47
+
48
+ # Initialize client
49
+ mi = MemoryClient(api_key="mi_sk_...")
50
+
51
+ # Process content → meaning
52
+ umo = mi.umo.process("Meeting notes from today", user_ulid="01ABC...")
53
+
54
+ # Search meaning
55
+ results = mi.umo.search("What did we discuss?", user_ulid="01ABC...", explain=True)
56
+
57
+ # Match for recommendations
58
+ match = mi.umo.match("01ABC...", "01XYZ...", explain=True)
59
+
60
+ # Get explanation
61
+ explanation = mi.umo.explain("01ABC...")
62
+
63
+ # Delete for GDPR
64
+ result = mi.umo.delete(user_ulid="01ABC...")
65
+ ```
66
+
67
+ ## Key Features
68
+
69
+ - **Meaning-First Architecture**: Raw content discarded after processing
70
+ - **Five Core Operations**: Process, Search, Match, Explain, Delete
71
+ - **Provenance Tracking**: Cryptographic verification of content lineage
72
+ - **GDPR Compliance**: One-call data deletion with audit proof
73
+ - **Built-in Telemetry**: Debug logs for content processing
74
+ - **Simplified API**: Only 12 essential exports
75
+
76
+ ## Installation
77
+
78
+ ```bash
79
+ pip install memoryintelligence
80
+ ```
81
+
82
+ ## Usage Guide
83
+
84
+ ### Initialize the Client
85
+
86
+ ```python
87
+ from memoryintelligence import MemoryClient
88
+
89
+ # For production (API key required)
90
+ mi = MemoryClient(api_key="mi_sk_prod_...")
91
+
92
+ # For development
93
+ mi = MemoryClient(api_key="mi_sk_dev_...")
94
+
95
+ # For specific user (multi-tenant)
96
+ user_mi = mi.for_user("01USER12345678901234567890")
97
+ ```
98
+
99
+ ### Process Content
100
+
101
+ Convert raw content to meaning (discards raw content by default):
102
+
103
+ ```python
104
+ from memoryintelligence import RetentionPolicy, PIIHandling, ProvenanceMode
105
+
106
+ umo = mi.umo.process(
107
+ "Budget approved for Q3 initiatives",
108
+ user_ulid="01ABC...",
109
+ retention_policy=RetentionPolicy.MEANING_ONLY,
110
+ pii_handling=PIIHandling.EXTRACT_AND_REDACT,
111
+ provenance_mode=ProvenanceMode.STANDARD
112
+ )
113
+
114
+ print(umo.entities) # [Entity(text="Q3", type="DATE"), ...]
115
+ print(umo.topics) # ["budget", "initiatives"]
116
+ print(umo.svo_triples) # [SVOTriple(subject="budget", verb="approved", object="initiatives")]
117
+ print(umo.umo_id) # "01KGE95Q4P9H89H63T26FNKKBR"
118
+ ```
119
+
120
+ ### Search for Meaning
121
+
122
+ Find relevant memories with explanation:
123
+
124
+ ```python
125
+ from datetime import datetime, timezone
126
+
127
+ results = mi.umo.search(
128
+ "Q3 budget decisions",
129
+ user_ulid="01ABC...",
130
+ explain=True,
131
+ limit=5,
132
+ topics=["budget", "finance"],
133
+ date_from=datetime(2024, 1, 1, tzinfo=timezone.utc)
134
+ )
135
+
136
+ for result in results.results:
137
+ print(f"Score: {result.score:.2f}")
138
+ print(f"Summary: {result.umo.summary}")
139
+ if result.explain:
140
+ print(f"Why: {result.explain.human.summary}")
141
+ ```
142
+
143
+ ### Match for Recommendations
144
+
145
+ Compare two memories for relevance:
146
+
147
+ ```python
148
+ match = mi.umo.match(
149
+ source_ulid="01ABC...",
150
+ candidate_ulid="01XYZ...",
151
+ explain=True
152
+ )
153
+
154
+ print(f"Match score: {match.score}")
155
+ print(f"Is match: {match.match}")
156
+ if match.explain:
157
+ print(f"Reason: {match.explain.human.summary}")
158
+ ```
159
+
160
+ ### Get Explanations
161
+
162
+ Understand why content is relevant:
163
+
164
+ ```python
165
+ from memoryintelligence import ExplainLevel
166
+
167
+ explanation = mi.umo.explain(
168
+ "01ABC...",
169
+ level=ExplainLevel.FULL
170
+ )
171
+
172
+ print(explanation.human.summary)
173
+ print(explanation.human.key_reasons)
174
+ print(explanation.audit.semantic_score)
175
+ ```
176
+
177
+ ### Delete Data
178
+
179
+ GDPR-compliant data removal:
180
+
181
+ ```python
182
+ from memoryintelligence import Scope
183
+
184
+ result = mi.umo.delete(
185
+ user_ulid="01ABC...",
186
+ scope=Scope.USER
187
+ )
188
+
189
+ print(f"Deleted {result.deleted_count} memories")
190
+ ```
191
+
192
+ ## Async Support
193
+
194
+ For async frameworks:
195
+
196
+ ```python
197
+ from memoryintelligence import AsyncMemoryClient
198
+
199
+ mi = AsyncMemoryClient(api_key="mi_sk_...")
200
+
201
+ # Process
202
+ umo = await mi.umo.process("Content", user_ulid="01ABC...")
203
+
204
+ # Search with iteration
205
+ async for result in mi.umo.search_iter("query", user_ulid="01ABC..."):
206
+ print(result.umo.summary)
207
+
208
+ # Batch processing
209
+ contents = ["Note 1", "Note 2", "Note 3"]
210
+ results = await mi.umo.process_batch(contents, user_ulid="01ABC...")
211
+ ```
212
+
213
+ ## Edge Deployment (HIPAA/Air-gapped)
214
+
215
+ For regulated industries:
216
+
217
+ ```python
218
+ from memoryintelligence import EdgeClient
219
+
220
+ # HIPAA-compliant edge deployment
221
+ edge = EdgeClient(
222
+ endpoint="https://mi.internal.yourcompany.com",
223
+ api_key="mi_sk_...",
224
+ hipaa_mode=True
225
+ )
226
+
227
+ # Process locally (data never leaves)
228
+ umo = edge.umo.process(clinical_note, user_ulid="01PATIENT...")
229
+
230
+ # Air-gapped (no external calls)
231
+ air_gapped = EdgeClient(
232
+ endpoint="https://mi.internal.com",
233
+ air_gapped=True # No API key needed
234
+ )
235
+ ```
236
+
237
+ ## Error Handling
238
+
239
+ ```python
240
+ from memoryintelligence import (
241
+ MemoryClient,
242
+ LicenseError,
243
+ RateLimitError,
244
+ ValidationError,
245
+ AuthenticationError
246
+ )
247
+
248
+ try:
249
+ mi = MemoryClient(api_key="mi_sk_...")
250
+ umo = mi.umo.process("Content", user_ulid="01ABC...")
251
+ except LicenseError as e:
252
+ print(f"License expired {e.days_expired} days ago")
253
+ print(f"Renew at: {e.renew_url}")
254
+ except RateLimitError as e:
255
+ print(f"Rate limited. Retry after {e.retry_after} seconds")
256
+ except ValidationError as e:
257
+ print(f"Validation failed: {e.message}")
258
+ except AuthenticationError:
259
+ print("Invalid API key")
260
+ ```
261
+
262
+ ## Webhook Verification
263
+
264
+ ```python
265
+ from memoryintelligence import verify_webhook_signature
266
+
267
+ # Verify webhook from Memory Intelligence
268
+ is_valid = verify_webhook_signature(
269
+ payload=request_body,
270
+ signature=headers["X-MI-Signature"],
271
+ secret="whsec_..."
272
+ )
273
+ ```
274
+
275
+ ## Monitoring & Telemetry
276
+
277
+ The SDK provides built-in telemetry for operational visibility:
278
+
279
+ ```python
280
+ import logging
281
+ logging.basicConfig(level=logging.DEBUG)
282
+ ```
283
+
284
+ ### Key Log Events:
285
+ - `DEBUG`: Content processing metrics (size, time)
286
+ - `INFO`: Operation completion with results
287
+ - `WARNING`: PII detection events
288
+ - `ERROR`: API and integration errors
289
+
290
+ ## Configuration
291
+
292
+ Environment variables:
293
+
294
+ ```bash
295
+ # Required for persistent encryption
296
+ export MI_ENCRYPTION_KEY="$(openssl rand -base64 32)"
297
+
298
+ # API configuration
299
+ export MI_API_KEY="mi_sk_live_..."
300
+ export MI_BASE_URL="https://api.memoryintelligence.dev"
301
+ ```
302
+
303
+ ## Documentation
304
+
305
+ Full documentation is available at:
306
+ - [API Reference](https://docs.memoryintelligence.dev)
307
+ - [Getting Started Guide](https://memoryintelligence.dev/docs/getting-started)
308
+
309
+ ## Support
310
+
311
+ For SDK issues, please contact:
312
+ - support@memoryintelligence.dev
313
+ - GitHub Issues: [Create New Issue](https://github.com/memoryintelligence/sdk-python/issues/new)
314
+
315
+ ## License
316
+
317
+ This SDK is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.