Before You Start
- Complete Quickstart to understand basic operations
- Ensure you have LLM Providers configured (
LLM_API_KEYin.env) - Provision a Neptune Analytics graph in your AWS account (AWS instructions), and give it a vector search dimension matching your embedding model’s dimension
- Install the Neptune extra:
uv pip install "cognee[neptune]" - Make AWS credentials authorized for that graph available to the standard AWS SDK chain — environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION, plusAWS_SESSION_TOKENfor temporary credentials), a shared profile, or an instance role.load_dotenv()makes.envvalues work as environment variables - Set
GRAPH_IDin.envto your graph’s identifier; the script turns it into aneptune-graph://<GRAPH_ID>endpoint - Read Graph Stores and Vector Stores for the rest of the backend settings
Code in Action
What Just Happened
Step 1: Build the Graph Endpoint
neptune-graph://<GRAPH_ID>, so the only cloud-specific value the script needs is the graph identifier. Reading it from the environment keeps the identifier — and the AWS credentials the SDK picks up alongside it — out of the code.
Step 2: Use One Graph as Both Stores
Step 3: Point Cognee at Local Directories
Step 4: Remember the Sample Text
remember() ingests both passages, extracts entities and relationships, and writes the resulting nodes, edges, and embeddings into your Neptune Analytics graph. dataset_name groups everything this call produces so a later search can be scoped to it.
Step 5: Query the Graph and Its Vectors
SearchType.GRAPH_COMPLETION retrieves the triplets stored around the query and asks the LLM to answer from them, which exercises the graph side of the store. SearchType.CHUNKS returns the raw text chunks behind a query instead, exercising the vector side — together they confirm both halves of the Neptune Analytics backend are populated. datasets=[dataset_name] limits the second search to the dataset created above.
Graph Stores
Every graph backend cognee supports, and their settings.
Vector Stores
Per-provider vector settings, including the Neptune Analytics block.
Store Configurations
Copy-paste
.env blocks for the other supported store combinations, including the local default.