Skip to main content

cognee.forget()

Description

forget() is the unified deletion API in Cognee v1.0.
  • Use it to remove a single data item from a dataset.
  • Use it to delete an entire dataset.
  • Use everything=True to remove all memory owned by the current user.
  • Use memory_only=True to clear graph and vector memory while keeping raw dataset records so the content can be reprocessed.
For the full behavior walkthrough, see Forget.

Parameters

Optional[UUID]
default:"None"
Specific data item to remove. Requires dataset to also be set.
Optional[Union[str, UUID]]
default:"None"
Dataset name or UUID. When used alone, deletes the whole dataset. When paired with data_id, deletes only that item from the dataset.
bool
default:"False"
Deletes all datasets and memory owned by the current user.
bool
default:"False"
Deletes only graph and vector memory for the target dataset or data item while keeping underlying dataset records.
Any
default:"None"
Runs the operation under a specific user context instead of the default user.

Return value

forget() returns a summary dictionary. Depending on the mode, it includes fields like status, dataset_id, data_id, or datasets_removed.

Examples

For lower-level data-management APIs, see datasets, delete(), and prune.