- name
- cognee-recall
- description
- Use when querying cognee memory with recall() (or search()) — picking a search type, understanding auto-routing, scoping to datasets, node sets or sessions, getting context or citations instead of an answer, reading the results, or debugging empty or unexpected results.
Query memory with recall()
recall() is cognee's query API. It picks a search strategy, searches the
graph and (with a session) the session cache, and returns a list of tagged
results.
import cognee
results = await cognee.recall("Where was Einstein born?")
for r in results:
print(r.source, r.text) # e.g. "graph", "Einstein was born in Ulm."
Without datasets it covers every dataset the user can read, but dataset
routing (always on, no off switch) scores those datasets
against the query on their global context index and searches only the best
DATASET_ROUTING_TOP_K (default 1), plus any dataset that has no index yet.
A dataset farther than DATASET_ROUTING_DISTANCE_CUTOFF (cosine distance,
default 0.8) is skipped, and when none is within it all are searched; datasets
within DATASET_ROUTING_TIE_MARGIN (default 0.001) of the last routed one are
searched too. A routed search that finds nothing is widened to the rest. The
search log prints every dataset's distance. Routing assumes
one embedding model across datasets; after an EMBEDDING_MODEL change it
logs a warning and every readable dataset is searched. Pass
datasets=["research"] (names) or dataset_ids=[...] (UUIDs, which win) to
pin the scope yourself; an explicit scope is never routed.
Use it
How the search type is picked
- An explicit
query_type=SearchType.Xalways wins. - With no usable LLM key nothing can write an answer, so on both paths
HYBRID_COMPLETION,GRAPH_COMPLETIONandRAG_COMPLETIONrun withonly_context=True(the assembled prompt instead of an answer), and a routedTEMPORALorBROADbecomesHYBRID_COMPLETIONwithonly_context=True; a routedCODEneeds no LLM and runs as it is. - Without an explicit type, the router (
auto_route=True, the default). It is five regex rules, first match wins, no LLM call:- the whole query is one
"quoted phrase"→CHUNKS_LEXICAL - mentions coding rules/standards/conventions or code-review guidelines
→
CODING_RULES - code phrasing right next to an identifier (
what calls parse_config,where is CodeRetriever defined, ) → , running its operation over the identifiers
- the whole query is one