CortexDB Docs
Integrations

LlamaIndex

Use CortexDB as a retriever and chat memory buffer for LlamaIndex.

CortexDB plugs into LlamaIndex as a retriever and as a chat memory buffer backed by hybrid recall.

Install

pip install cortexdbai[llamaindex]

Retriever

from cortexdb import Cortex
from cortexdb.integrations.llamaindex import CortexDBRetriever

client = Cortex(api_url="https://api-v1.cortexdb.ai", actor="user:alice",
                bearer=os.environ["CORTEX_TOKEN"])

retriever = CortexDBRetriever(client=client, scope="org:acme/user:alice")
nodes = retriever.retrieve("What did we decide about caching?")

Chat memory buffer

from cortexdb.integrations.llamaindex import CortexDBChatMemoryBuffer

memory = CortexDBChatMemoryBuffer(client=client, scope="org:acme/user:alice")
# pass memory= into a ChatEngine / AgentRunner

Fact fields: id and subject.id

If you render facts yourself, live facts are { id, subject: { type, id }, object: { type, datatype, value } } — use fact["id"] and fact["subject"]["id"] (there is no fact_id / subject.name). Facts need enrichment on a self-host — see Self-hosting defaults.

See also

On this page