CortexDB Docs
Integrations

Instructor

Use CortexDB as a semantic cache for Instructor structured extractions.

CortexDB serves as a semantic cache for Instructor — recall a prior structured extraction instead of re-calling the LLM when a similar input has been seen.

Install

pip install cortexdbai[instructor]

Cache

from cortexdb import Cortex
from cortexdb.integrations.instructor import CortexDBCache

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

cache = CortexDBCache(client=client, scope="org:acme/service:extractor")
# wrap your instructor-patched client's calls with the cache

See also

On this page