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.
DataPoints: Atomic Units of Knowledge
DataPoints are the smallest building blocks in Cognee.They represent atomic units of knowledge — carrying both your actual content and the context needed to process, index, and connect it. They’re the reason Cognee can turn raw documents into something that’s both searchable (via vectors) and connected (via graphs).
What are DataPoints
- Atomic — each DataPoint represents one concept or unit of information.
- Structured — implemented as Pydantic models for validation and serialization.
- Contextual — carry provenance, versioning, and indexing hints so every step downstream knows where data came from and how to use it.
Core Structure
A DataPoint is just a Pydantic model with a set of standard fields.See example class definition
See example class definition
id— unique identifier (shared across all three stores, linking vector, graph, and relational records for the same DataPoint)created_at,updated_at— timestamps (ms since epoch)version— for tracking changes and schema evolutiontopological_rank— an integer indicating the DataPoint’s position in a dependency hierarchy. Lower ranks mean fewer dependencies. For example, anEntitythat other DataPoints reference would have a lower rank than aTextSummarythat depends on it. Defaults to0.metadata.index_fields— critical: determines which fields are embedded for vector searchtype— the Python class name of the DataPoint subclass (e.g.,"Person","Book")belongs_to_set— groups related DataPoints
Indexing & Embeddings
Themetadata.index_fields tells Cognee which fields to embed into the vector store.
This is the mechanism behind semantic search.
- Fields in
index_fields→ converted into embeddings - Each indexed field → its own vector collection named
Class_field(e.g., aPersonDataPoint withindex_fields=["name"]creates aPerson_namevector collection). TheClasspart comes from the Python class name of your DataPoint subclass. - Non-indexed fields → stay as regular properties in the graph and relational stores
- Choosing what to index controls search granularity
Cross-store retrieval: When a vector search finds a match, Cognee uses the shared
id to retrieve the full DataPoint from the graph store, which holds all properties (not just the indexed field). This is how Cognee returns complete results from a semantic search.From DataPoints to the Graph
When you calladd_data_points(), Cognee automatically:
- Embeds the indexed fields into vectors
- Converts the object into nodes and edges in the knowledge graph
- Stores provenance in the relational store
Examples and details
Example: indexing only one field
Example: indexing only one field
"name" is semantically searchableExample: Book → Author transformation
Example: Book → Author transformation
Relationship syntax options
Relationship syntax options
Built-in DataPoint types
Built-in DataPoint types
Cognee ships with several built-in DataPoint types:
- Documents — wrappers for source files (Text, PDF, Audio, Image)
Document(metadata.index_fields=["name"])
- Chunks — segmented portions of documents
DocumentChunk(metadata.index_fields=["text"])
- Summaries — generated text or code summaries
TextSummary/CodeSummary(metadata.index_fields=["text"])
- Entities — named objects (people, places, concepts)
Entity,EntityType(metadata.index_fields=["name"])
- Edges — relationships between DataPoints
Edge— links between DataPoints
Example: custom DataPoint with best practices
Example: custom DataPoint with best practices
- Keep it small — one concept per DataPoint
- Index carefully — only fields that matter for semantic search
- Use built-in types first — extend with custom subclasses when needed
- Version deliberately — track changes with
version - Group related points — with
belongs_to_set
Updating DataPoints
Updating DataPoints
To update a custom DataPoint, mutate its fields, call For documents and files remembered via
update_version() to record the change, then re-add it with add_data_points(). The upsert replaces the existing node in all three stores.cognee.remember(), use cognee.update() instead — it replaces the existing item in the target dataset by deleting the old data_id, re-adding the new content, and re-running graph processing for that dataset.How versioning worksChanging a field on a DataPoint does not automatically create a new revision or persist anything by itself.
In other words, versioning is manual:- Edit the DataPoint fields
- Call
update_version()if this should count as a new revision - Re-add the DataPoint with
add_data_points()to persist the updated state
update_version(), you mark your in-memory object as a new revision before writing it back with add_data_points(). It does two things:- Increments
versionby 1. New DataPoints start atversion=1. - Sets
updated_atto the current UTC timestamp in milliseconds.
Deleting DataPoints
Deleting DataPoints
Use the
cognee.datasets API:Dataset routing: which dataset receives add_data_points output?
Dataset routing: which dataset receives add_data_points output?
add_data_points() does not accept a dataset parameter directly. Dataset assignment is carried by the PipelineContext (ctx) that Cognee injects automatically when your task runs inside run_pipeline.ctx.dataset holds the resolved dataset object. add_data_points uses it to write provenance records (user, dataset, data item) to the relational store.If you call add_data_points outside a pipeline (without a ctx), nodes and edges are still written to the graph and vector stores, but no dataset-level provenance is recorded — the data is not associated with any named dataset.embed_triplets: graph-structure embeddings
embed_triplets: graph-structure embeddings
add_data_points accepts an embed_triplets: bool = False parameter. When set to True, Cognee derives (subject → predicate → object) triplets from the graph edges and indexes each one as a Triplet DataPoint embedding.embed_triplets=True when:- Your queries describe relationships (e.g., “products made by company X”)
- You want to retrieve graph edges via semantic similarity, not just individual nodes
False (the default) for standard node-level retrieval.For the same idea applied after graph creation, see Triplet Embeddings.Deduplication: preventing duplicate entities
Deduplication: preventing duplicate entities
By default, each DataPoint receives a random UUID4 on instantiation. To make identical entities share the same node — and avoid duplicates — mark one or more fields as the deduplication key.Cognee automatically populates How it worksWhen one or more identity fields are defined and all of them resolve on the instance, Cognee generates a deterministic UUID5 from the class name and the field values instead of a random UUID4. Two
- Option 1: `Dedup()`
- Option 2: `identity_fields`
identity_fields from the Dedup() annotations. No explicit metadata declaration is needed.Product instances with the same sku produce the same id, so add_data_points upserts them onto the same graph node rather than creating a duplicate. If an identity field is missing and has no default, Cognee falls back to a random UUID4.Checking whether a DataPoint already existsBecause the ID is deterministic, you can check existence by constructing the instance (which generates the identity ID) and querying the graph engine:Tasks
Learn how DataPoints are created and processed
Pipelines
See how DataPoints flow through processing workflows
Main Operations
Understand how DataPoints are used in Remember, Improve, and Recall