Skip to content

Commit d0fe5ea

Browse files
authored
Added a warning about the default value of return_context for GraphRAG.search changing (#191)
1 parent 789fb35 commit d0fe5ea

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

docs/source/user_guide_kg_builder.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ with the same label and identical "name" property.
446446
It can be used like this:
447447

448448
.. code:: python
449+
449450
from neo4j_graphrag.experimental.components.resolver import (
450451
SinglePropertyExactMatchResolver,
451452
)

src/neo4j_graphrag/generation/graphrag.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from __future__ import annotations
1616

1717
import logging
18+
import warnings
1819
from typing import Any, Optional
1920

2021
from pydantic import ValidationError
@@ -84,12 +85,18 @@ def search(
8485
query_text: str = "",
8586
examples: str = "",
8687
retriever_config: Optional[dict[str, Any]] = None,
87-
return_context: bool = False,
88+
return_context: bool | None = None,
8889
) -> RagResultModel:
89-
"""This method performs a full RAG search:
90-
1. Retrieval: context retrieval
91-
2. Augmentation: prompt formatting
92-
3. Generation: answer generation with LLM
90+
"""
91+
.. warning::
92+
The default value of 'return_context' will change from 'False' to 'True' in a future version.
93+
94+
95+
This method performs a full RAG search:
96+
1. Retrieval: context retrieval
97+
2. Augmentation: prompt formatting
98+
3. Generation: answer generation with LLM
99+
93100
94101
Args:
95102
query_text (str): The user question
@@ -102,6 +109,12 @@ def search(
102109
RagResultModel: The LLM-generated answer
103110
104111
"""
112+
if return_context is None:
113+
warnings.warn(
114+
"The default value of 'return_context' will change from 'False' to 'True' in a future version.",
115+
DeprecationWarning,
116+
)
117+
return_context = False
105118
try:
106119
validated_data = RagSearchModel(
107120
query_text=query_text,

0 commit comments

Comments
 (0)