File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed
src/neo4j_genai/generation Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 44
55### Added
66- Add optional custom_prompt arg to the Text2CypherRetriever class.
7-
7+
8+ ### Changed
9+ - ` GraphRAG.search ` method first parameter has been renamed ` query_text ` (was ` query ` ) for consistency with the retrievers interface.
10+ - Made ` GraphRAG.search ` method backwards compatible with the query parameter, raising warnings to encourage using query_text instead.
11+
812## 0.3.1
913
1014### Fixed
1115- Corrected initialization to allow specifying the embedding model name.
1216- Removed sentence_transformers from embeddings/__ init__ .py to avoid ImportError when the package is not installed.
1317
14- ### Changed
15- - ` GraphRAG.search ` method first parameter has been renamed ` query_text ` (was ` query ` ) for consistency with the retrievers interface.
16-
1718## 0.3.0
1819
1920### Added
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ rag = GraphRAG(retriever=retriever, llm=llm)
128128
129129# Query the graph
130130query_text = " How do I do similarity search in Neo4j?"
131- response = rag.search(query = query_text, retriever_config = {" top_k" : 5 })
131+ response = rag.search(query_text = query_text, retriever_config = {" top_k" : 5 })
132132print (response.answer)
133133```
134134
Original file line number Diff line number Diff line change 1515from __future__ import annotations
1616
1717import logging
18+ import warnings
1819from typing import Any , Optional
1920
2021from pydantic import ValidationError
@@ -53,10 +54,11 @@ def __init__(
5354
5455 def search (
5556 self ,
56- query_text : str ,
57+ query_text : str = "" ,
5758 examples : str = "" ,
5859 retriever_config : Optional [dict [str , Any ]] = None ,
5960 return_context : bool = False ,
61+ query : Optional [str ] = None ,
6062 ) -> RagResultModel :
6163 """This method performs a full RAG search:
6264 1. Retrieval: context retrieval
@@ -69,12 +71,28 @@ def search(
6971 retriever_config (Optional[dict]): Parameters passed to the retriever
7072 search method; e.g.: top_k
7173 return_context (bool): Whether to return the retriever result (default: False)
74+ query (Optional[str]): The user question. Will be deprecated in favor of query_text.
7275
7376 Returns:
7477 RagResultModel: The LLM-generated answer
7578
7679 """
7780 try :
81+ if query is not None :
82+ if query_text :
83+ warnings .warn (
84+ "Both 'query' and 'query_text' are provided, 'query_text' will be used." ,
85+ DeprecationWarning ,
86+ stacklevel = 2 ,
87+ )
88+ elif isinstance (query , str ):
89+ warnings .warn (
90+ "'query' is deprecated and will be removed in a future version, please use 'query_text' instead." ,
91+ DeprecationWarning ,
92+ stacklevel = 2 ,
93+ )
94+ query_text = query
95+
7896 validated_data = RagSearchModel (
7997 query_text = query_text ,
8098 examples = examples ,
You can’t perform that action at this time.
0 commit comments