Skip to content

Commit

Permalink
feat: allow not to create working dir (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
gusye1234 committed Oct 1, 2024
1 parent 4951fc2 commit 895c451
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nano_graphrag/graphrag.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class GraphRAG:
enable_llm_cache: bool = True

# extension
always_create_working_dir: bool = True
addon_params: dict = field(default_factory=dict)
convert_response_to_json_func: callable = convert_response_to_json

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

if not os.path.exists(self.working_dir):
if not os.path.exists(self.working_dir) and self.always_create_working_dir:
logger.info(f"Creating working directory {self.working_dir}")
os.makedirs(self.working_dir)

Expand Down
13 changes: 12 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ await graph_func.aquery(...)

### Available Parameters

`GraphRAG` and `QueryParam` are `dataclass` in Python. Use `help(GraphRAG)` and `help(QueryParam)` to see all available parameters!
`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.



Expand Down Expand Up @@ -188,6 +188,17 @@ Below are the components you can use:

## Advances



<details>
<summary>Some setup options</summary>

- `GraphRAG(...,always_create_working_dir=False,...)` will skip the dir-creating step. Use it if you switch all your components to non-file storages.

</details>



<details>
<summary>Only query the related context</summary>

Expand Down

0 comments on commit 895c451

Please sign in to comment.