custom_prompt to cognee.remember() to control entity types, relationship labels, and extraction rules.
Before you start:
- Complete Quickstart to understand basic operations
- Ensure you have LLM Providers configured
- Have some text or files to process
Code in Action
Step 1: Write a Custom Prompt
Step 2: Remember with Your Custom Prompt
remember() to ingest the text and build the graph in one pass. The same approach works with multiple documents, files, or entire datasets.
Step 3: Ask Questions
cognee.recall(...) with SearchType.GRAPH_COMPLETION to get answers that leverage your custom extraction rules.
custom_prompt vs system_prompt: which prompt goes where
Cognee uses two distinct prompts at two different stages, and they are not interchangeable. Passing one where the other is expected will silently have no effect.
- Cognee v1.0
- Legacy
system_prompt_path only loads files from cognee’s built-in prompts directory (cognee/infrastructure/llm/prompts). An absolute path, a .. segment that leaves the directory, or a symlink that points outside it raises PromptPathOutsideBaseDirectoryError. To use prompt text from your own project, read the file yourself and pass its contents as system_prompt.Additional examples
Additional examples about Custom prompts are available on our github.Full Example
Latest guide
Latest guide
Legacy guide
Legacy guide
This simple example uses a few strings for demonstration. In practice, you can add multiple documents, files, or entire datasets - the custom prompt processing works the same way across all your data.