|
1 | 1 | import logging |
2 | 2 | import warnings |
3 | | -from typing import Optional |
4 | 3 | from falkordb import FalkorDB |
| 4 | +from typing import Optional, Union |
5 | 5 | from graphrag_sdk.ontology import Ontology |
6 | 6 | from graphrag_sdk.source import AbstractSource |
7 | 7 | from graphrag_sdk.chat_session import ChatSession |
@@ -45,14 +45,14 @@ def __init__( |
45 | 45 | model (GenerativeModel): The Google GenerativeModel to use. |
46 | 46 | host (str): FalkorDB hostname. |
47 | 47 | port (int): FalkorDB port number. |
48 | | - username (str|None): FalkorDB username. |
49 | | - password (str|None): FalkorDB password. |
50 | | - ontology (Ontology|None): Ontology to use. |
51 | | - cypher_system_instruction (str|None): Cypher system instruction. Make sure you have {ontology} in the instruction. |
52 | | - qa_system_instruction (str|None): QA system instruction. |
53 | | - cypher_gen_prompt (str|None): Cypher generation prompt. Make sure you have {question} in the prompt. |
54 | | - qa_prompt (str|None): QA prompt. Make sure you have {question}, {context} and {cypher} in the prompt. |
55 | | - cypher_gen_prompt_history (str|None): Cypher generation prompt with history. Make sure you have {question} and {last_answer} in the prompt. |
| 48 | + username (Union[str, None]): FalkorDB username. |
| 49 | + password (Union[str, None]): FalkorDB password. |
| 50 | + ontology (Union[Ontology, None]): Ontology to use. |
| 51 | + cypher_system_instruction (Union[str, None]): Cypher system instruction. Make sure you have {ontology} in the instruction. |
| 52 | + qa_system_instruction (Union[str, None]): QA system instruction. |
| 53 | + cypher_gen_prompt (Union[str, None]): Cypher generation prompt. Make sure you have {question} in the prompt. |
| 54 | + qa_prompt (Union[str, None]): QA prompt. Make sure you have {question}, {context} and {cypher} in the prompt. |
| 55 | + cypher_gen_prompt_history (Union[str, None]): Cypher generation prompt with history. Make sure you have {question} and {last_answer} in the prompt. |
56 | 56 | """ |
57 | 57 |
|
58 | 58 | if not isinstance(name, str) or name == "": |
@@ -165,7 +165,7 @@ def process_sources( |
165 | 165 |
|
166 | 166 |
|
167 | 167 | def _create_graph_with_sources( |
168 | | - self, sources: list[AbstractSource] | None = None, instructions: str = None, hide_progress: bool = False |
| 168 | + self, sources: Union[list[AbstractSource], None] = None, instructions: str = None, hide_progress: bool = False |
169 | 169 | ) -> None: |
170 | 170 |
|
171 | 171 | step = ExtractDataStep( |
|
0 commit comments