Skip to content

Commit

Permalink
Added a warning about the default value of return_context for GraphRA…
Browse files Browse the repository at this point in the history
…G.search changing
  • Loading branch information
alexthomas93 committed Oct 18, 2024
1 parent 789fb35 commit 0c63bdb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/source/user_guide_kg_builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
23 changes: 18 additions & 5 deletions src/neo4j_graphrag/generation/graphrag.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from __future__ import annotations

import logging
import warnings
from typing import Any, Optional

from pydantic import ValidationError
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 0c63bdb

Please sign in to comment.