|
1 | | -# Ailly Prompt Workflow |
| 1 | +# Lliam - LLM-powered IAM Policy Metadata Enhancement |
2 | 2 |
|
3 | | -This project automates the process of generating, running, parsing, and applying [Ailly](https://www.npmjs.com/package/@ailly/cli) prompt outputs to an AWS DocGen project. It combines all steps into one streamlined command using a single Python script. |
| 3 | +Lliam automates the process of generating, running, parsing, and applying [Ailly](https://www.npmjs.com/package/@ailly/cli) prompt outputs to enhance AWS DocGen IAM policy examples with rich metadata. |
4 | 4 |
|
5 | 5 | --- |
6 | 6 |
|
7 | 7 | ## 📦 Overview |
8 | 8 |
|
9 | | -This tool: |
10 | | -1. **Generates** Ailly prompts from DocGen snippets. |
11 | | -2. **Runs** Ailly CLI to get enhanced metadata. |
12 | | -3. **Parses** Ailly responses into structured JSON. |
13 | | -4. **Updates** your DocGen examples with the new metadata. |
| 9 | +Lliam provides a multi-step workflow to: |
| 10 | +1. **Generate** Ailly prompts from DocGen IAM policy snippets |
| 11 | +2. **Execute** Ailly CLI to get LLM-enhanced metadata |
| 12 | +3. **Update** your DocGen examples with the enhanced metadata |
14 | 13 |
|
15 | | -All of this is done with one command. |
| 14 | +The workflow is designed around three main commands that can be run independently or in sequence. |
16 | 15 |
|
17 | 16 | --- |
18 | 17 |
|
19 | 18 | ## ✅ Prerequisites |
20 | 19 |
|
21 | 20 | - Python 3.8+ |
22 | | -- Node.js and npm (for `npx`) |
23 | | -- A DocGen project directory |
| 21 | +- Node.js and npm (for `npx @ailly/cli`) |
| 22 | +- A DocGen project directory with IAM policy examples |
24 | 23 |
|
25 | 24 | --- |
26 | 25 |
|
27 | 26 | ## 🚀 Usage |
28 | 27 |
|
29 | | -From your project root, run: |
| 28 | +### Step 1: Create Prompts |
| 29 | + |
| 30 | +Generate Ailly prompts from your DocGen IAM policy examples: |
30 | 31 |
|
31 | 32 | ```bash |
32 | | -python -m aws_doc_sdk_examples_tools.agent.bin.main \ |
| 33 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app create-prompts \ |
33 | 34 | /path/to/your/docgen/project \ |
34 | 35 | --system-prompts path/to/system_prompt.txt |
35 | 36 | ``` |
36 | 37 |
|
37 | | -### 🔧 Arguments |
| 38 | +### Step 2: Run Ailly |
38 | 39 |
|
39 | | -- `iam_tributary_root`: Path to the root directory of your IAM policy tributary |
40 | | -- `--system-prompts`: List of system prompt files or strings to include in the Ailly configuration |
41 | | -- `--skip-generation`: Skip the prompt generation and Ailly execution steps (useful for reprocessing existing outputs) |
| 40 | +Execute Ailly to generate enhanced metadata: |
42 | 41 |
|
43 | | -Run `python -m aws_doc_sdk_examples_tools.agent.bin.main update --help` for more info. |
| 42 | +```bash |
| 43 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app run-ailly |
| 44 | +``` |
44 | 45 |
|
45 | | ---- |
| 46 | +Optionally process specific batches: |
| 47 | +```bash |
| 48 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app run-ailly --batches "batch_01,batch_02" |
| 49 | +``` |
46 | 50 |
|
47 | | -## 🗂 What This Does |
| 51 | +### Step 3: Update Repository |
48 | 52 |
|
49 | | -Under the hood, this script: |
| 53 | +Apply the enhanced metadata back to your DocGen examples: |
50 | 54 |
|
51 | | -1. Creates a directory `.ailly_iam_policy` containing: |
52 | | - - One Markdown file per snippet. |
53 | | - - A `.aillyrc` configuration file. |
| 55 | +```bash |
| 56 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app update-reservoir \ |
| 57 | + /path/to/your/docgen/project |
| 58 | +``` |
54 | 59 |
|
55 | | -2. Runs `npx @ailly/cli` to generate `.ailly.md` outputs. |
| 60 | +Optionally update specific batches or packages: |
| 61 | +```bash |
| 62 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app update-reservoir \ |
| 63 | + /path/to/your/docgen/project \ |
| 64 | + --batches "batch_01,batch_02" \ |
| 65 | + --packages "package1,package2" |
| 66 | +``` |
| 67 | + |
| 68 | +--- |
56 | 69 |
|
57 | | -3. Parses the Ailly `.ailly.md` files into a single `iam_updates.json` file. |
| 70 | +## 🗂 Workflow Details |
58 | 71 |
|
59 | | -4. Updates each matching `Example` in the DocGen instance with: |
60 | | - - `title` |
61 | | - - `title_abbrev` |
62 | | - - `synopsis` |
| 72 | +1. **Prompt Generation**: |
| 73 | + - Scans DocGen examples for IAM policies with default metadata prefixes |
| 74 | + - Creates batched Markdown files in `.ailly_iam_policy/` |
| 75 | + - Generates `.aillyrc` configuration with system prompts |
| 76 | + |
| 77 | +2. **Ailly Execution**: |
| 78 | + - Runs `npx @ailly/cli` on generated prompts |
| 79 | + - Processes batches to manage large datasets |
| 80 | + - Generates `.ailly.md` response files |
| 81 | + |
| 82 | +3. **Metadata Update**: |
| 83 | + - Parses Ailly responses for enhanced metadata |
| 84 | + - Updates DocGen examples with `title`, `title_abbrev`, `synopsis`, and `description` |
| 85 | + - Applies service-specific suffixes to metadata |
63 | 86 |
|
64 | 87 | --- |
65 | 88 |
|
66 | | -## 💡 Example |
| 89 | +## 💡 Example Workflow |
67 | 90 |
|
68 | 91 | ```bash |
69 | | -python -m aws_doc_sdk_examples_tools.agent.bin.main \ |
| 92 | +# Generate prompts from IAM policy examples |
| 93 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app create-prompts \ |
70 | 94 | ~/projects/AWSIAMPolicyExampleReservoir \ |
71 | | - --system-prompts prompts/system_prompt.txt |
| 95 | + --system-prompts prompts/iam_system_prompt.txt |
| 96 | + |
| 97 | +# Run Ailly on all generated prompts |
| 98 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app run-ailly |
| 99 | + |
| 100 | +# Update the repository with enhanced metadata |
| 101 | +python -m aws_doc_sdk_examples_tools.lliam.entry_points.lliam_app update-reservoir \ |
| 102 | + ~/projects/AWSIAMPolicyExampleReservoir |
72 | 103 | ``` |
73 | 104 |
|
74 | | -This will: |
75 | | -- Write prompts and config to `.ailly_iam_policy/` |
76 | | -- Run Ailly and capture results |
77 | | -- Parse and save output as `.ailly_iam_policy/iam_updates.json` |
78 | | -- Apply updates to your DocGen examples |
| 105 | +This workflow will: |
| 106 | +- Extract IAM policy snippets and create batched prompts in `.ailly_iam_policy/` |
| 107 | +- Execute Ailly to generate enhanced metadata |
| 108 | +- Parse responses and update your DocGen examples with rich metadata |
0 commit comments