> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Inspecting Hybrid Retrieval Context

> See exactly what HYBRID_COMPLETION sends to the completion step, and shape it with retriever_specific_config

This guide shows you how to look inside `SearchType.HYBRID_COMPLETION` — the default search type — before it turns into a final answer, and how to shape which parts of that context are included.

## Before You Start

* Be familiar with the main concepts of [Recall](/core-concepts/main-operations/recall).
* Complete the [Understand Recall with RAG Completion guide](/guides/rag-recall) to see the shared `recall()` parameters this guide builds on (`query_text`, `datasets`, `only_context`) in action.

## Code in Action

```python theme={null}
import asyncio

import cognee
from cognee import SearchType

QUERY = "What did Alice and Bob work on together?"


async def main():
    await cognee.remember(
        [
            "Alice and Bob were PhD students in Berlin from 2021 to 2024.",
            "Alice and Bob worked on a paper together in 2023.",
            "Alice joined Cognee as a backend engineer in 2025.",
            "Bob joined Cognee as a data scientist in 2026.",
            "Alice and Bob worked together on some sections of the documentation of Cognee in 2026.",
            "New sections of the documentation are available since July 2026.",
        ],
        self_improvement=False,
    )

    context_passage_focused = await cognee.recall(
        query_text=QUERY,
        query_type=SearchType.HYBRID_COMPLETION,
        only_context=True,
        retriever_specific_config={
            "chunks_top_k": 5,
            "entities_top_k": 0,
            "facts_top_k": 0,
        },
    )
    print(context_passage_focused)

    context_entity_focused = await cognee.recall(
        query_text=QUERY,
        query_type=SearchType.HYBRID_COMPLETION,
        only_context=True,
        retriever_specific_config={
            "chunks_top_k": 0,
            "entities_top_k": 5,
            "max_edges_per_entity": 5,
            "facts_top_k": 0,
        },
    )
    print(context_entity_focused)

    context_fact_focused = await cognee.recall(
        query_text=QUERY,
        query_type=SearchType.HYBRID_COMPLETION,
        only_context=True,
        retriever_specific_config={
            "chunks_top_k": 0,
            "entities_top_k": 0,
            "facts_top_k": 5,
        },
    )
    print(context_fact_focused)

    context_balanced = await cognee.recall(
        query_text=QUERY,
        query_type=SearchType.HYBRID_COMPLETION,
        only_context=True,
        retriever_specific_config={
            "chunks_top_k": 2,
            "entities_top_k": 2,
            "max_edges_per_entity": 3,
            "facts_top_k": 2,
        },
    )
    print(context_balanced)

    answer = await cognee.recall(
        query_text=QUERY,
        query_type=SearchType.HYBRID_COMPLETION,
        retriever_specific_config={
            "chunks_top_k": 2,
            "entities_top_k": 2,
            "max_edges_per_entity": 3,
            "facts_top_k": 2,
        },
    )
    print(answer)


if __name__ == "__main__":
    asyncio.run(main())
```

## What Just Happened

Each `recall()` call below sets `only_context=True` plus one or two `retriever_specific_config` limits to `0`, which removes that section from the context entirely. A non-zero limit controls how many items of that section are included — a larger number produces a more detailed (and larger) context.

### Step 1: Ingest the Example Dataset

```python theme={null}
await cognee.remember(
    [
        "Alice and Bob were PhD students in Berlin from 2021 to 2024.",
        "Alice and Bob worked on a paper together in 2023.",
        "Alice joined Cognee as a backend engineer in 2025.",
        "Bob joined Cognee as a data scientist in 2026.",
        "Alice and Bob worked together on some sections of the documentation of Cognee in 2026.",
        "New sections of the documentation are available since July 2026.",
    ],
    self_improvement=False,
)
```

A handful of sentences about Alice and Bob gives hybrid retrieval something to find — entities, a relationship between them, and the passages they come from.

### Step 2: Passage-Focused Context

```python theme={null}
context_passage_focused = await cognee.recall(
    query_text=QUERY,
    query_type=SearchType.HYBRID_COMPLETION,
    only_context=True,
    retriever_specific_config={
        "chunks_top_k": 5,
        "entities_top_k": 0,
        "facts_top_k": 0,
    },
)
print(context_passage_focused)
```

With `entities_top_k` and `facts_top_k` at `0`, `context_passage_focused` contains only matched passages — the raw text chunks that matched the query, combining lexical (keyword) and semantic (embedding) search, with no graph entities or derived facts.

Use this when you want to see raw supporting text without any graph-derived summarization — for example, to quote source text verbatim, or to debug retrieval quality without graph-derived noise in the way.

### Step 3: Entity-Focused Context

```python theme={null}
context_entity_focused = await cognee.recall(
    query_text=QUERY,
    query_type=SearchType.HYBRID_COMPLETION,
    only_context=True,
    retriever_specific_config={
        "chunks_top_k": 0,
        "entities_top_k": 5,
        "max_edges_per_entity": 5,
        "facts_top_k": 0,
    },
)
print(context_entity_focused)
```

With `chunks_top_k` and `facts_top_k` at `0`, `context_entity_focused` contains only matched entities — nodes from the graph (like `Alice`, `Bob`, `Cognee`) — and the edges connected to each one (capped by `max_edges_per_entity`), rendered as short sentences such as `Alice contributed to documentation`.

Use this when you care about which entities are connected and how, more than the exact wording of the source text.

### Step 4: Fact-Focused Context

```python theme={null}
context_fact_focused = await cognee.recall(
    query_text=QUERY,
    query_type=SearchType.HYBRID_COMPLETION,
    only_context=True,
    retriever_specific_config={
        "chunks_top_k": 0,
        "entities_top_k": 0,
        "facts_top_k": 5,
    },
)
print(context_fact_focused)
```

With `chunks_top_k` and `entities_top_k` at `0`, `context_fact_focused` contains only the compact, fact-style statements derived from graph edges — a more compact form of the same relationships shown in Step 3, with no raw passages and no entity listings.

Use this when you want the smallest possible context — for example to get a quick relationship summary without the full passage text or entity listings.

### Step 5: Balanced Context

```python theme={null}
context_balanced = await cognee.recall(
    query_text=QUERY,
    query_type=SearchType.HYBRID_COMPLETION,
    only_context=True,
    retriever_specific_config={
        "chunks_top_k": 2,
        "entities_top_k": 2,
        "max_edges_per_entity": 3,
        "facts_top_k": 2,
    },
)
print(context_balanced)
```

All three sections are present in `context_balanced`, each capped at a small limit. This mirrors the default behavior, just with tighter limits — useful when you want a compact context that still draws on passages, entities, and facts together.

## Generating the Final Answer

Every call above passes `only_context=True`, so `recall()` stops after assembling the context and never reaches the completion step. Drop `only_context=True` — the retrieval, ranking, and context assembly stay exactly the same — and `recall()` sends that same context to the LLM to generate a real answer instead:

```python theme={null}
answer = await cognee.recall(
    query_text=QUERY,
    query_type=SearchType.HYBRID_COMPLETION,
    retriever_specific_config={
        "chunks_top_k": 2,
        "entities_top_k": 2,
        "max_edges_per_entity": 3,
        "facts_top_k": 2,
    },
)
print(answer)
```

A typical result:

```text theme={null}
They worked on a paper in 2023 and on some sections of the Cognee documentation in 2026.
```

(The exact wording depends on the LLM provider you use.) This works the same way with any of the `retriever_specific_config` shapes from Steps 2-5 above — passage-focused, entity-focused, fact-focused, or balanced — since `only_context` only controls whether the completion step runs, not what gets retrieved.

<Columns cols={2}>
  <Card title="Recall" icon="search" href="/core-concepts/main-operations/recall">
    Understand recall()'s full parameter surface and auto-routing behavior
  </Card>

  <Card title="SearchType" icon="list" href="/python-api/search-type">
    See every search type and its retriever\_specific\_config options
  </Card>
</Columns>
