remember β recall round trip with no LLM API key anywhere: GLiNER2 extracts the graph and writes the chunk summaries, and fastembed embeds them on CPU. Use it when you have no key to spend, when the data cannot leave the machine, or when you want a smoke test that proves the pipeline itself does not depend on an LLM.
Before You Start
- Complete Quickstart to understand basic operations
- Install the two extras this script needs β GLiNER for extraction, fastembed for embeddings:
- Allow for the first-run downloads: the GLiNER model is about 800 MB and the
bge-small-en-v1.5embedding model about 130 MB, both cached after the first run - No LLM API key is needed, and none is used β the script removes
LLM_API_KEYandOPENAI_API_KEYfrom the environment before importing cognee - Read Local Setup (No API Key) for the
.envform of local provider configuration, and Embedding Providers to swap in a different fastembed model with its matching dimensions
Code in Action
What Just Happened
Step 1: Clear Any Inherited API Key
.env file would quietly make this run an ordinary LLM run. Popping both variables first is what makes the result meaningful: everything after this line has no LLM to call.
Step 2: Select the Local Extractor and Embedder
GRAPH_EXTRACTOR=gliner swaps cognifyβs LLM task list for the GLiNER one, which extracts entities and relationships and writes each chunkβs summary locally instead of prompting a model. Both halves have to be local: leaving EMBEDDING_PROVIDER at its default would send embedding requests to OpenAI and fail without a key. EMBEDDING_DIMENSIONS and EMBEDDING_MAX_COMPLETION_TOKENS describe bge-small-en-v1.5 β 384-dimensional vectors and a 512-token input limit β so cognee sizes its vector collections and chunks correctly. The whole block runs before import cognee because cognee reads this configuration at import time, hence the # noqa: E402 markers on the imports.
Step 3: Remember the Text Locally
remember() then ingests the text, builds the graph with GLiNER, and embeds the results with fastembed. Because no LLM task is in the pipeline, cognee also skips the first-run LLM connection probe, so the missing key never becomes an error.
Step 4: Recall With the Default Search Type
query_type, recall() normally answers with an LLM-written completion. When no usable LLM key is configured it falls back to SearchType.CHUNKS instead β a pure vector search that returns the matching text chunks β which is why the call works here at all. The printed search_type on each result reports which type actually ran.
Step 5: Search the GLiNER Summaries
SearchType.SUMMARIES searches the per-chunk summaries rather than the raw chunks. On this run those summaries were written by GLiNER from the extracted entities and relationships, not by an LLM, and they are indexed and retrievable like any other summary. Both CHUNKS and SUMMARIES are retrieval-only search types, so requesting one explicitly stays LLM-free.
What Still Needs an LLM
The graph, the summaries, and the two searches above run entirely on local models. Two things still do not:- Completion search types. Anything ending in
_COMPLETIONβGRAPH_COMPLETION,RAG_COMPLETION,HYBRID_COMPLETIONβ retrieves context and then asks an LLM to write the answer. Requesting one without a key fails; see Search Basics for the full list of types and what each returns. - Per-turn feedback analysis.
AUTO_FEEDBACKis disabled above because session feedback is itself an LLM call. For the same reason,remember()here is left withoutsession_ids, soimprove()only runs the default triplet and vector enrichment.
Local Setup (No API Key)
The
.env form of local provider configuration, plus local-run troubleshooting.Custom GLiNER Extraction
Pass your own entity and relation labels, and measure what extraction dropped.
Embedding Providers
Pick a different fastembed model and its matching dimensions.
Search Basics
Every search type, and which ones need an LLM to answer.