> ## 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.

# Custom Summarization Schema

> Swap the structured output shape cognify asks the LLM for when summarizing, via summary_schema (Python's summarization_model).

cognee-rust mirrors Python's `summarization_model` cognify knob as
`CognifyConfig.summary_schema`, consumed by the standalone cognify pipeline. Its
graph-extraction counterpart is the
[custom graph schema](/rust/guides/custom-graph-schema.md).

## What it does

Replaces the default `SummarizedContent` shape requested from the LLM during the
summarization stage with your own JSON Schema. Mirrors Python's
`CognifyConfig.summarization_model`.

## Requirement

The schema **must** contain a string `summary` property — the pipeline reads
`summary` to build each `TextSummary`. This is validated up front by
[`validate_summary_schema`](https://github.com/topoteretes/cognee-rs/blob/main/crates/cognify/src/config.rs), so a bad schema
fails at config time rather than mid-pipeline.

## Example (programmatic)

```rust theme={null}
use cognee_cognify::CognifyConfig;
use serde_json::json;

let schema = json!({
    "type": "object",
    "properties": {
        "summary":  { "type": "string" },
        "keywords": { "type": "array", "items": { "type": "string" } }
    },
    "required": ["summary"]
});

let config = CognifyConfig::default()
    .with_summary_schema(schema)?;   // returns Err if `summary` is missing/non-string
```

This path **is consumed**: the summarization task constructs
`SummaryExtractor::new_with_schema(llm, config.summary_schema)`
([`crates/cognify/src/tasks.rs`](https://github.com/topoteretes/cognee-rs/blob/main/crates/cognify/src/tasks.rs)), and the
extractor requests the custom schema when it is `Some`
([`crates/cognify/src/summarization/extractor.rs`](https://github.com/topoteretes/cognee-rs/blob/main/crates/cognify/src/summarization/extractor.rs)).

## Via top-level config

`cognee` exposes a runtime setter mirroring Python's
`cognee.config.set_summarization_model(...)`:

```rust theme={null}
config.set_summarization_schema(schema)?;  // ConfigManager, crates/lib/src/config.rs
```

`Settings::cognify_config` applies it, so every cognify run started from these
settings requests this shape. It can be set only programmatically or through a
binding's `set`: it has no env var and is not saved, so `cognee-cli` cannot set it.

## Pointers

* [`CognifyConfig`](https://github.com/topoteretes/cognee-rs/blob/main/crates/cognify/src/config.rs) — `summary_schema` and `validate_summary_schema`.
* [`crates/cognify/src/summarization/extractor.rs`](https://github.com/topoteretes/cognee-rs/blob/main/crates/cognify/src/summarization/extractor.rs) — summary schema consumption.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.