File tree Expand file tree Collapse file tree 2 files changed +42
-3
lines changed
src/neo4j_genai/generation Expand file tree Collapse file tree 2 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ LLMInterface
156156
157157
158158OpenAILLM
159- =========
159+ ---------
160160
161161.. autoclass :: neo4j_genai.llm.OpenAILLM
162162 :members:
@@ -182,6 +182,17 @@ ERExtractionTemplate
182182 :members:
183183
184184
185+ ****
186+ RAG
187+ ****
188+
189+ GraphRAG
190+ ========
191+
192+ .. autoclass :: neo4j_genai.generation.graphrag.GraphRAG
193+ :members:
194+
195+
185196.. _database-interaction-section :
186197
187198********************
Original file line number Diff line number Diff line change 3434
3535
3636class GraphRAG :
37+ """Performs a GraphRAG search using a specific retriever
38+ and LLM.
39+
40+ Example:
41+
42+ .. code-block:: python
43+
44+ import neo4j
45+ from neo4j_genai.retrievers import VectorRetriever
46+ from neo4j_genai.llm.openai_llm import OpenAILLM
47+ from neo4j_genai.generation import GraphRAG
48+
49+ driver = neo4j.GraphDatabase.driver(URI, auth=AUTH)
50+
51+ retriever = VectorRetriever(driver, "vector-index-name", custom_embedder)
52+ llm = OpenAILLM()
53+ graph_rag = GraphRAG(retriever, llm)
54+ graph_rag.search(query_text="Find me a book about Fremen")
55+
56+ Args:
57+ retriever (Retriever): The retriever used to find relevant context to pass to the LLM.
58+ llm (LLMInterface): The LLM used to generate the answer.
59+ prompt_template (RagTemplate): The prompt template that will be formatted with context and user question and passed to the LLM.
60+
61+ Raises:
62+ RagInitializationError: If validation of the input arguments fail.
63+ """
64+
3765 def __init__ (
3866 self ,
3967 retriever : Retriever ,
@@ -67,10 +95,10 @@ def search(
6795
6896 Args:
6997 query_text (str): The user question
70- examples: Examples added to the LLM prompt.
98+ examples (str) : Examples added to the LLM prompt.
7199 retriever_config (Optional[dict]): Parameters passed to the retriever
72100 search method; e.g.: top_k
73- return_context (bool): Whether to return the retriever result (default: False)
101+ return_context (bool): Whether to append the retriever result to the final result (default: False)
74102 query (Optional[str]): The user question. Will be deprecated in favor of query_text.
75103
76104 Returns:
You can’t perform that action at this time.
0 commit comments