Skip to main content

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.

cognee.forget()

async def forget(
    *,
    data_id: Optional[UUID] = None,
    dataset: Optional[Union[str, UUID]] = None,
    everything: bool = False,
    memory_only: bool = False,
    user=None,
) -> dict

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

data_id
Optional[UUID]
default:"None"
Specific data item to remove. Requires dataset to also be set.
dataset
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.
everything
bool
default:"False"
Deletes all datasets and memory owned by the current user.
memory_only
bool
default:"False"
Deletes only graph and vector memory for the target dataset or data item while keeping underlying dataset records.
user
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

import cognee

# Delete a dataset
await cognee.forget(dataset="product_docs")

# Delete only graph and vector memory so the dataset can be re-cognified
await cognee.forget(dataset="product_docs", memory_only=True)
For lower-level data-management APIs, see datasets, delete(), and prune.