lore-context-middleware
Python SDK middleware for Lore Context — wraps openai.OpenAI / anthropic.Anthropic clients to auto-inject memory pre-LLM-call and auto-retain post-LLM-call without requiring the AI to call an MCP tool.
Install
pip install lore-context-middleware lore-context openai
Quick start
import os
from openai import OpenAI
from lore_context import LoreContextApiClient
from lore_context_middleware import with_memory_hooks
lore = LoreContextApiClient(token=os.environ["LORE_API_KEY"])
openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
client = with_memory_hooks(openai_client, lore, mode="hybrid")
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "What was that Postgres dump command?"}],
)
Modes
| Mode | inject | retain | tools exposed |
|---|---|---|---|
hybrid (default) |
✅ | ✅ | ✅ |
context |
✅ | ✅ | ❌ |
tools |
❌ | ❌ | ✅ |
See docs/sdk/middleware-modes.md in the lore-cloud repo for full mode semantics.
License
MIT
Metadata
Release files for lore-context-middleware 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lore_context_middleware-0.1.0.tar.gz | 12.3 kB | Without provenance | Details for lore_context_middleware-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lore_context_middleware-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lore_context_middleware-0.1.0-py3-none-any.whl |
Total release size: 22.9 kB
Release files / lore_context_middleware-0.1.0.tar.gz
| Download URL | lore_context_middleware-0.1.0.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31aeea29cfde0177f24b136a95565268a6071d85e954683b1b23212e5875f4d2
|
|
BLAKE2b-256 checksum How to use checksums |
e92de44652e58b0acb7211615a1d1cd0b14806de4443c3c425e256529923cbf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / lore_context_middleware-0.1.0-py3-none-any.whl
| Download URL | lore_context_middleware-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8cf99e5898237c970d752d0ce5ab935d0d479a3921f582ce13f3790a89edc971
|
|
BLAKE2b-256 checksum How to use checksums |
5cd9011345cf29a772f0da9a076da713b381f16b92b975cb2fd5f4dbf7c4fa8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for lore-context-middleware 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.