diff --git a/docs/source/user_guide_kg_builder.rst b/docs/source/user_guide_kg_builder.rst index 2b91eaff..c2e0a609 100644 --- a/docs/source/user_guide_kg_builder.rst +++ b/docs/source/user_guide_kg_builder.rst @@ -446,6 +446,7 @@ with the same label and identical "name" property. It can be used like this: .. code:: python + from neo4j_graphrag.experimental.components.resolver import ( SinglePropertyExactMatchResolver, ) diff --git a/src/neo4j_graphrag/generation/graphrag.py b/src/neo4j_graphrag/generation/graphrag.py index f62302ac..3d65fcb5 100644 --- a/src/neo4j_graphrag/generation/graphrag.py +++ b/src/neo4j_graphrag/generation/graphrag.py @@ -15,6 +15,7 @@ from __future__ import annotations import logging +import warnings from typing import Any, Optional from pydantic import ValidationError @@ -84,12 +85,18 @@ def search( query_text: str = "", examples: str = "", retriever_config: Optional[dict[str, Any]] = None, - return_context: bool = False, + return_context: bool | None = None, ) -> RagResultModel: - """This method performs a full RAG search: - 1. Retrieval: context retrieval - 2. Augmentation: prompt formatting - 3. Generation: answer generation with LLM + """ + .. warning:: + The default value of 'return_context' will change from 'False' to 'True' in a future version. + + + This method performs a full RAG search: + 1. Retrieval: context retrieval + 2. Augmentation: prompt formatting + 3. Generation: answer generation with LLM + Args: query_text (str): The user question @@ -102,6 +109,12 @@ def search( RagResultModel: The LLM-generated answer """ + if return_context is None: + warnings.warn( + "The default value of 'return_context' will change from 'False' to 'True' in a future version.", + DeprecationWarning, + ) + return_context = False try: validated_data = RagSearchModel( query_text=query_text,