When to use this
After ingestion, entity descriptions may be fragmented or repetitive because each description is derived from a single chunk. This lower-level Memify pipeline rewrites each entity’s description using the LLM and the entity’s full neighborhood context, producing more coherent and complete descriptions. Useimprove() for the standard self-improvement flow. Use this guide when you specifically want entity-description consolidation.
Before you start:
- Complete Quickstart to understand basic operations
- Ensure you have LLM Providers configured
- Have an existing knowledge graph with
Entitynodes
Code in Action
Step 1: Clear Existing Data
Start from a clean state so the before-and-after visualizations only reflect this example run.Step 2: Build and Visualize the Graph
Create a focused graph with only people, cities, andlives_in relationships, then save a visualization of the graph before consolidation.
Step 3: Consolidate and Visualize Again
Run the consolidation pipeline to rewrite entity descriptions in place, then save a second visualization so you can compare the graph before and after enrichment.What Changed in Your Graph
- Existing
Entitynodedescriptionfields are rewritten using LLM analysis of each entity’s neighbors and edges. - No new nodes are created. The pipeline updates descriptions in place.
- Descriptions become more coherent because the LLM sees each entity in the context of its graph neighborhood, not just the original chunk text.
- The before and after HTML files make it easy to inspect how the graph changed.
Additional Information
- Runnable guide script available on our GitHub
- Pipeline implementation: consolidate_entity_descriptions.py
Under the hood
Under the hood
Three tasks run in sequence:
get_entities_with_neighborhood— loads allEntitynodes and fetches their edges and neighbor nodes.generate_consolidated_entities— sends each entity plus neighborhood to the LLM, which returns a refined description.add_data_points— writes the updatedEntityobjects back to the graph and vector DB.
Latest guide
Latest guide
Legacy guide
Legacy guide
Troubleshooting
Troubleshooting
- No entities found — the graph must already contain
Entitynodes. Runcognee.remember()first. - LLM errors — verify that your LLM provider is configured. See LLM Providers.
- Permission errors — the user must have write access to the target dataset. See Permissions.
Improve
Understand the current improvement workflow
Self-Improvement Quickstart
Bridge session memory and enrich a dataset
Search
Query the enriched graph with specialized search types