Integrations
DSPy
Use CortexDB as a retriever and memory for DSPy programs.
CortexDB backs DSPy programs as a retriever (dspy.Retrieve-style) and a persistent memory.
Install
pip install cortexdbai[dspy]Retriever + memory
from cortexdb import Cortex
from cortexdb.integrations.dspy import CortexDBRetriever, CortexDBMemory
client = Cortex(api_url="https://api-v1.cortexdb.ai", actor="user:alice",
bearer=os.environ["CORTEX_TOKEN"])
scope = "org:acme/user:alice"
retriever = CortexDBRetriever(client=client, scope=scope, k=8)
memory = CortexDBMemory(client=client, scope=scope)Fact fields: id and subject.id
If you render facts yourself, use fact["id"] and fact["subject"]["id"] — live facts are
{ id, subject: { type, id }, object: { type, datatype, value } } (no fact_id / subject.name).
Facts need enrichment on a self-host — see Self-hosting defaults.