Skip to content

Commit 895c451

Browse files
committed
feat: allow not to create working dir (#69)
1 parent 4951fc2 commit 895c451

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

nano_graphrag/graphrag.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class GraphRAG:
125125
enable_llm_cache: bool = True
126126

127127
# extension
128+
always_create_working_dir: bool = True
128129
addon_params: dict = field(default_factory=dict)
129130
convert_response_to_json_func: callable = convert_response_to_json
130131

@@ -144,7 +145,7 @@ def __post_init__(self):
144145
"Switched the default openai funcs to Azure OpenAI if you didn't set any of it"
145146
)
146147

147-
if not os.path.exists(self.working_dir):
148+
if not os.path.exists(self.working_dir) and self.always_create_working_dir:
148149
logger.info(f"Creating working directory {self.working_dir}")
149150
os.makedirs(self.working_dir)
150151

readme.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ await graph_func.aquery(...)
156156

157157
### Available Parameters
158158

159-
`GraphRAG` and `QueryParam` are `dataclass` in Python. Use `help(GraphRAG)` and `help(QueryParam)` to see all available parameters!
159+
`GraphRAG` and `QueryParam` are `dataclass` in Python. Use `help(GraphRAG)` and `help(QueryParam)` to see all available parameters! Or check out the [Advances](#Advances) section to see some options.
160160

161161

162162

@@ -188,6 +188,17 @@ Below are the components you can use:
188188

189189
## Advances
190190

191+
192+
193+
<details>
194+
<summary>Some setup options</summary>
195+
196+
- `GraphRAG(...,always_create_working_dir=False,...)` will skip the dir-creating step. Use it if you switch all your components to non-file storages.
197+
198+
</details>
199+
200+
201+
191202
<details>
192203
<summary>Only query the related context</summary>
193204

0 commit comments

Comments
 (0)