Skip to main content

What it does

Overrides the LLM prompt that the cognify pipeline uses for the entity/relationship (graph) extraction stage. Mirrors Python’s cognify custom_prompt parameter. When set, the FactExtractor uses your prompt instead of the built-in default.

When to use it

  • Steer extraction toward a domain vocabulary (“treat each section header as a Topic node…”).
  • Tighten or loosen what counts as an entity/relationship for your corpus.

How it is wired

This knob is consumed by the standalone pipeline. CognifyConfig carries custom_extraction_prompt: Option<String>, and the graph-extraction task passes it straight into FactExtractor::extract_facts(text, prompt) (crates/cognify/src/tasks.rs, the extract_graph_from_data task). None falls back to the default prompt.

Via configuration

GRAPH_PROMPT_PATH (key graph_prompt_path) sets the same prompt from the environment or a config file. Settings::cognify_config turns it into custom_extraction_prompt for every cognify run started from the settings: cognee-cli cognify, add-and-cognify, remember and improve, and the bindings. It takes a file path or the name of one of the built-in Python prompt files; see Chunking & tokenizer for the accepted values.

Example (programmatic)

The builder is CognifyConfig::with_custom_prompt; the field is custom_extraction_prompt.

CLI

There is no CLI flag for the extraction prompt — cognee-cli cognify does not expose custom_extraction_prompt. Set GRAPH_PROMPT_PATH instead (see above), or use the CognifyConfig builder in Rust. Note this is distinct from cognee-cli search --system-prompt[-path], which sets the search answer-generation prompt, not the cognify extraction prompt.

Pointers