File tree Expand file tree Collapse file tree
aws_doc_sdk_examples_tools/agent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,13 @@ def write_prompts(doc_gen: DocGen, out: Path) -> None:
2828 # Postfix with `.md` so Ailly will pick it up.
2929 prompt_path = out / f"{ example_id } .md"
3030 # This assumes we're running DocGen specifically on AWSIAMPolicyExampleReservoir.
31- snippet_key = example .languages ["IAMPolicyGrammar" ].versions [0 ].excerpts [0 ].snippet_files [0 ].replace ("/" , "." )
31+ snippet_key = (
32+ example .languages ["IAMPolicyGrammar" ]
33+ .versions [0 ]
34+ .excerpts [0 ]
35+ .snippet_files [0 ]
36+ .replace ("/" , "." )
37+ )
3238 snippet = snippets [snippet_key ]
3339 prompt_path .write_text (snippet .code , encoding = "utf-8" )
3440
@@ -59,13 +65,18 @@ def parse_prompts_arg(values: List[str]) -> List[str]:
5965 return prompts
6066
6167
68+ def validate_root_path (doc_gen_root : Path ):
69+ assert "AWSIAMPolicyExampleReservoir" in str (doc_gen_root )
70+ assert doc_gen_root .is_dir ()
71+
72+
6273def main (
6374 doc_gen_root : Path , system_prompts : List [str ], out : str = ".ailly_prompts"
6475) -> None :
6576 """Generate prompts and configuration files for Ailly."""
6677 out_path = Path (out )
6778 setup_ailly (system_prompts , out_path )
68-
79+ validate_root_path ( doc_gen_root )
6980 doc_gen = make_doc_gen (doc_gen_root )
7081 write_prompts (doc_gen , out_path )
7182
You can’t perform that action at this time.
0 commit comments