Skip to content

Commit

Permalink
Update the ConfigReader to allow for empty chunk-by arrays (microsoft…
Browse files Browse the repository at this point in the history
  • Loading branch information
darthtrevino authored Jul 26, 2024
1 parent 4c229af commit 8565cd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20240726200425411495.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "update config-reader to allow for empty chunk-by arrays"
}
8 changes: 5 additions & 3 deletions graphrag/config/create_graphrag_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,14 @@ def hydrate_parallelization_params(
base_dir=reader.str(Fragment.base_dir) or defs.STORAGE_BASE_DIR,
)
with reader.envvar_prefix(Section.chunk), reader.use(values.get("chunks")):
group_by_columns = reader.list("group_by_columns", "BY_COLUMNS")
if group_by_columns is None:
group_by_columns = defs.CHUNK_GROUP_BY_COLUMNS

chunks_model = ChunkingConfig(
size=reader.int("size") or defs.CHUNK_SIZE,
overlap=reader.int("overlap") or defs.CHUNK_OVERLAP,
group_by_columns=reader.list("group_by_columns", "BY_COLUMNS")
or defs.CHUNK_GROUP_BY_COLUMNS,
encoding_model=reader.str(Fragment.encoding_model),
group_by_columns=group_by_columns,
)
with (
reader.envvar_prefix(Section.snapshot),
Expand Down
5 changes: 3 additions & 2 deletions graphrag/config/environment_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def list(

if result is None:
result = self.str(key, env_key)
if result:
return [s.strip() for s in result.split(",")]
if result is not None:
result = [s.strip() for s in result.split(",")]
return [s for s in result if s]
return default_value

0 comments on commit 8565cd6

Please sign in to comment.