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.improve()

async def improve(
    dataset: Union[str, UUID] = "main_dataset",
    *,
    run_in_background: bool = False,
    node_name: Optional[List[str]] = None,
    session_ids: Optional[List[str]] = None,
    **kwargs,
)

Description

improve() enriches an existing graph after ingestion.
  • Without session_ids, it runs the normal enrichment pass over the dataset.
  • With session_ids, it can also apply feedback weights, persist session Q&A into the graph, and sync enriched graph context back into sessions.
For the full behavior walkthrough, see Improve.

Parameters

dataset
Union[str, UUID]
default:"'main_dataset'"
Dataset name or UUID to improve.
run_in_background
bool
default:"False"
Starts the improvement pipeline asynchronously.
node_name
Optional[List[str]]
default:"None"
Restricts improvement to specific named entities or node sets.
session_ids
Optional[List[str]]
default:"None"
Session IDs whose feedback and Q&A content should be bridged into the permanent graph.

Additional keyword options

OptionTypeWhat it does
extraction_taskslistOverrides the extraction task set used during enrichment.
enrichment_taskslistOverrides the enrichment task set used during enrichment.
dataAnySupplies explicit data to advanced improvement pipelines when supported.
node_typeTypeChanges which node type the enrichment pass targets.
userobjectRuns the operation under a specific user context.
vector_db_configdictOverrides vector database configuration for this call.
graph_db_configdictOverrides graph database configuration for this call.
feedback_alphafloatControls how strongly session feedback changes graph weights.

Return value

improve() returns the pipeline result from the enrichment pass, the same underlying shape used by legacy memify().

Examples

import cognee

await cognee.improve(
    dataset="product_docs",
    session_ids=["support_chat_7"],
)
See also memify() if you need lower-level control over the legacy enrichment pipeline.