From ac234f47bd2da8c8ea8a5fab77a18ae9ea50fe94 Mon Sep 17 00:00:00 2001 From: Alonso Guevara Date: Thu, 19 Sep 2024 09:22:17 -0600 Subject: [PATCH] Fix prompt tune output path on cli (#1157) --- .semversioner/next-release/patch-20240919000033794082.json | 4 ++++ graphrag/prompt_tune/__main__.py | 2 +- graphrag/prompt_tune/cli.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .semversioner/next-release/patch-20240919000033794082.json diff --git a/.semversioner/next-release/patch-20240919000033794082.json b/.semversioner/next-release/patch-20240919000033794082.json new file mode 100644 index 00000000..522e6050 --- /dev/null +++ b/.semversioner/next-release/patch-20240919000033794082.json @@ -0,0 +1,4 @@ +{ + "type": "patch", + "description": "Fix prompt tune output path" +} diff --git a/graphrag/prompt_tune/__main__.py b/graphrag/prompt_tune/__main__.py index 1db893f2..aac668db 100644 --- a/graphrag/prompt_tune/__main__.py +++ b/graphrag/prompt_tune/__main__.py @@ -92,7 +92,7 @@ if __name__ == "__main__": ) parser.add_argument( "--output", - help="Directory to save generated prompts to. Default: 'prompts'", + help="Directory to save generated prompts to, relative to the root directory. Default: 'prompts'", type=str, default="prompts", ) diff --git a/graphrag/prompt_tune/cli.py b/graphrag/prompt_tune/cli.py index 0f4c795b..dd964260 100644 --- a/graphrag/prompt_tune/cli.py +++ b/graphrag/prompt_tune/cli.py @@ -43,7 +43,7 @@ async def prompt_tune( - chunk_size: The chunk token size to use. - language: The language to use for the prompts. - skip_entity_types: Skip generating entity types. - - output: The output folder to store the prompts. + - output: The output folder to store the prompts. Relative to the root directory. - n_subset_max: The number of text chunks to embed when using auto selection method. - k: The number of documents to select when using auto selection method. - min_examples_required: The minimum number of examples required for entity extraction prompts. @@ -67,7 +67,7 @@ async def prompt_tune( k=k, ) - output_path = Path(output).resolve() + output_path = (root_path / output).resolve() if output_path: reporter.info(f"Writing prompts to {output_path}") output_path.mkdir(parents=True, exist_ok=True)