|
1 | 1 | # ADA - AI Documentation Assistant |
2 | 2 |
|
3 | | -Welcome to ADA! This tool helps you convert documents and troubleshoot errors efficiently using Azure OpenAI's Large Language Models and the Azure Innovation Engine. |
| 3 | +ADA (AI Documentation Assistant) helps you create, convert, and manage Executable Documents efficiently using Azure OpenAI and Innovation Engine. |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -- Converts source markdown files to Exec Docs with proper formatting. |
8 | | -- Generates new Exec Docs from workload descriptions with auto-generated titles. |
9 | | -- Creates documentation for shell scripts while preserving the original code. |
10 | | -- Redacts Personally Identifiable Information (PII) from Exec Doc result blocks. |
11 | | -- Automatically identifies and generates dependency files referenced in documents. |
12 | | -- Performs comprehensive security vulnerability analysis on Exec Docs. |
13 | | -- Logs execution data to a CSV file for analytics. |
| 7 | +- **Convert to Exec Docs**: Transform existing markdown files to executable documents |
| 8 | +- **Generate New Exec Docs**: Create new executable documents from a workload description |
| 9 | +- **Reference Integration**: Include content from URLs and local files when generating documents |
| 10 | +- **Script Documentation**: Create comprehensive explanations for shell scripts |
| 11 | +- **PII Redaction**: Automatically redact sensitive information from result blocks |
| 12 | +- **Security Analysis**: Perform comprehensive security vulnerability assessments |
| 13 | +- **SEO Optimization**: Enhance document visibility and searchability |
| 14 | +- **Centralized Logging**: Track operations across sessions in a global log |
| 15 | +- **Docker Support**: Run ADA in an isolated container environment |
14 | 16 |
|
15 | 17 | ## Prerequisites |
16 | 18 |
|
17 | 19 | - Python 3.6 or higher |
18 | | -- An Azure OpenAI API key |
19 | | -- Required Python packages: `openai`, `azure-identity`, `requests`, `pyyaml` |
| 20 | +- Azure OpenAI API key and endpoint |
| 21 | +- Docker (optional, for containerized usage) |
20 | 22 |
|
21 | 23 | ## Installation |
22 | 24 |
|
| 25 | +### Option 1: Local Installation |
| 26 | + |
23 | 27 | 1. Clone the repository: |
24 | | - ```bash |
25 | | - git clone <repository-url> |
26 | | - cd <repository-directory> |
27 | | - ``` |
| 28 | + ```bash |
| 29 | + git clone <repository-url> |
| 30 | + cd <repository-directory>/tools |
| 31 | + ``` |
28 | 32 |
|
29 | 33 | 2. Install the required Python packages: |
30 | | - ```bash |
31 | | - pip install openai azure-identity requests pyyaml |
32 | | - ``` |
| 34 | + ```bash |
| 35 | + pip install -r requirements.txt |
| 36 | + ``` |
33 | 37 |
|
34 | | -3. Ensure you have the Azure OpenAI API key and endpoint set as environment variables: |
35 | | - ```bash |
36 | | - export AZURE_OPENAI_API_KEY=<your-azure-openai-api-key> |
37 | | - export AZURE_OPENAI_ENDPOINT=<your-azure-openai-endpoint> |
38 | | - ``` |
| 38 | +3. Set Azure OpenAI API credentials as environment variables: |
| 39 | + ```bash |
| 40 | + export AZURE_OPENAI_API_KEY=<your-azure-openai-api-key> |
| 41 | + export AZURE_OPENAI_ENDPOINT=<your-azure-openai-endpoint> |
| 42 | + ``` |
39 | 43 |
|
40 | | - To obtain an Azure OpenAI API key and endpoint, follow these steps: |
| 44 | + To obtain an Azure OpenAI API key and endpoint, follow these steps: |
41 | 45 |
|
42 | 46 | 1. **Sign in to the Azure Portal**: |
43 | 47 | - Navigate to [https://portal.azure.com](https://portal.azure.com) and log in with your Azure credentials. |
@@ -93,111 +97,136 @@ Welcome to ADA! This tool helps you convert documents and troubleshoot errors ef |
93 | 97 | By following these steps, you'll have your Azure OpenAI API key and endpoint configured, a model deployed, and your environment variables set up in a Linux environment, ready for integration into your applications. |
94 | 98 |
|
95 | 99 | For a visual walkthrough of creating an Azure OpenAI resource and deploying a model, you might find the following video helpful: |
96 | | - |
97 | | -## Usage |
98 | | -
|
99 | | -1. Run the script: |
100 | | - ```bash |
101 | | - python ada.py |
102 | | - ``` |
103 | | -
|
104 | | -2. Choose from the available options: |
105 | | - - Option 1: Convert an existing markdown file to an Exec Doc |
106 | | - - Option 2: Describe a workload to generate a new Exec Doc |
107 | | - - Option 3: Add descriptions to a shell script as an Exec Doc |
108 | | - - Option 4: Redact PII from an existing Exec Doc |
109 | | - - Option 5: Perform security vulnerability check on an Exec Doc |
110 | | -
|
111 | | -3. Follow the prompts to provide the required information: |
112 | | - - For file conversion, provide the path to your input file |
113 | | - - For workload descriptions, describe your intended workload in detail |
114 | | - - For shell script documentation, provide the path to your script and optional context |
115 | | - - For PII redaction, provide the path to your Exec Doc |
116 | | - - For security checks, provide the path to your Exec Doc |
117 | | -
|
118 | | -4. The tool will process your request based on the selected option: |
119 | | - - For options 1 and 2, it will convert or create an Exec Doc and run tests using Innovation Engine |
120 | | - - For options 3, 4, and 5, it will generate the requested output and save it to a file |
121 | | -
|
122 | | -5. For document conversion or creation, if the tests pass successfully, the final document will be saved with proper formatting. |
123 | | -
|
124 | | -## Script Workflow |
125 | 100 |
|
126 | | -1. **Initialization**: The script initializes the Azure OpenAI client and checks for required packages. |
| 101 | +### Option 2: Docker Installation |
127 | 102 |
|
128 | | -2. **Option Selection**: Prompts the user to select from available options for document processing. |
| 103 | +1. Build the Docker image: |
| 104 | + ```bash |
| 105 | + docker build -t ada-tool . |
| 106 | + ``` |
129 | 107 |
|
130 | | -3. **Input Collection**: Collects necessary inputs based on the selected option. |
| 108 | +2. Run ADA in a Docker container: |
| 109 | + ```bash |
| 110 | + docker run -it --rm \ |
| 111 | + -e AZURE_OPENAI_API_KEY="your_api_key_here" \ |
| 112 | + -e AZURE_OPENAI_ENDPOINT="your_endpoint_here" \ |
| 113 | + -v "$(pwd):/app/workspace" \ |
| 114 | + -v "$HOME/.azure:/root/.azure" \ |
| 115 | + -w /app/workspace \ |
| 116 | + ada-tool |
| 117 | + ``` |
131 | 118 |
|
132 | | -4. **Processing Based on Option**: |
133 | | - - **Convert Markdown**: Converts an existing markdown file to an Exec Doc |
134 | | - - **Generate New Doc**: Creates an Exec Doc from a workload description |
135 | | - - **Document Script**: Adds detailed explanations to a shell script |
136 | | - - **Redact PII**: Removes personally identifiable information from result blocks |
137 | | - - **Security Check**: Performs comprehensive security analysis |
138 | | -
|
139 | | -5. **For Document Conversion and Generation**: |
140 | | - - Install Innovation Engine if needed |
141 | | - - Process the document using Azure OpenAI's model |
142 | | - - Run tests on the document using Innovation Engine |
143 | | - - If tests fail, generate troubleshooting steps and attempt corrections |
144 | | - - If tests pass, finalize the document |
145 | | -
|
146 | | -6. **Final Output**: Saves the processed document and provides the file path. |
| 119 | +## Usage |
147 | 120 |
|
148 | | -7. **Dependency Generation**: Optionally identifies and creates dependency files referenced in the document. |
| 121 | +1. Run ADA: |
| 122 | + ```bash |
| 123 | + # Local installation |
| 124 | + python ada.py |
| 125 | + |
| 126 | + # Docker |
| 127 | + ./run-ada.sh |
| 128 | + ``` |
149 | 129 |
|
150 | | -8. **Logging**: Logs execution data to `execution_log.csv`. |
| 130 | +2. Select from the available options: |
| 131 | + - Option 1: Convert an existing markdown file to an Exec Doc |
| 132 | + - Option 2: Generate a new Exec Doc from a workload description |
| 133 | + - Option 3: Create descriptions for your shell script |
| 134 | + - Option 4: Redact PII from your Doc |
| 135 | + - Option 5: Perform security analysis on your Doc |
| 136 | + - Option 6: Perform SEO optimization on your Doc |
| 137 | +
|
| 138 | +3. Follow the prompts for each option: |
| 139 | + - For file conversion: provide the path to your source file |
| 140 | + - For generating new docs: describe the workload and optionally add reference data |
| 141 | + - For script documentation: provide the path to your script and context |
| 142 | + - For PII redaction: provide the path to your source document |
| 143 | + - For security analysis: provide the path to the document to analyze |
| 144 | + - For SEO optimization: provide the path to the document to optimize |
| 145 | +
|
| 146 | +## Output Location |
| 147 | +
|
| 148 | +- When generating a new Exec Doc (option 2), ADA creates a dedicated folder for the output |
| 149 | +- For all other operations, ADA saves output files in the same directory as the source file |
| 150 | +- Execution logs are saved in a centralized log.json file in the script directory |
| 151 | +
|
| 152 | +## Data Sources Integration |
| 153 | +
|
| 154 | +When generating a new Exec Doc, you can incorporate content from: |
| 155 | +- Web URLs (HTML content will be extracted) |
| 156 | +- Local files (content will be read directly) |
| 157 | +
|
| 158 | +These sources provide additional context for more comprehensive document generation. |
| 159 | +
|
| 160 | +## Docker Usage |
| 161 | +
|
| 162 | +The included Dockerfile provides a complete environment with all dependencies: |
| 163 | +- Python 3.13 |
| 164 | +- Azure CLI |
| 165 | +- Innovation Engine |
| 166 | +- All required Python packages |
| 167 | +
|
| 168 | +To use ADA with Docker: |
| 169 | +
|
| 170 | +1. Create a run-ada.sh script containing: |
| 171 | + ```bash |
| 172 | + #!/bin/bash |
| 173 | + |
| 174 | + # Build the Docker image |
| 175 | + docker build -t ada-tool . |
| 176 | + |
| 177 | + # Run the container with Azure OpenAI credentials and Azure auth |
| 178 | + docker run -it --rm \ |
| 179 | + -e AZURE_OPENAI_API_KEY="${AZURE_OPENAI_API_KEY}" \ |
| 180 | + -e AZURE_OPENAI_ENDPOINT="${AZURE_OPENAI_ENDPOINT}" \ |
| 181 | + -v "$(pwd):/app/workspace" \ |
| 182 | + -v "$HOME/.azure:/root/.azure" \ |
| 183 | + -w /app/workspace \ |
| 184 | + ada-tool |
| 185 | + ``` |
| 186 | +
|
| 187 | +2. Make it executable: |
| 188 | + ```bash |
| 189 | + chmod +x run-ada.sh |
| 190 | + ``` |
| 191 | +
|
| 192 | +3. Run ADA: |
| 193 | + ```bash |
| 194 | + ./run-ada.sh |
| 195 | + ``` |
151 | 196 |
|
152 | 197 | ## Advanced Features |
153 | 198 |
|
154 | | -### Dependency File Management |
155 | | -ADA can identify, generate, and manage auxiliary files referenced in your Exec Docs: |
156 | | -- Automatically detects files referenced in the document |
157 | | -- Creates dependency files with proper formatting based on file type |
158 | | -- Tracks existing files to prevent overwriting user modifications |
159 | | -- Intelligently updates dependency files when errors are detected |
160 | | -- Regenerates dependencies when major document changes occur |
| 199 | +### Centralized Logging |
| 200 | +ADA maintains a comprehensive log of all operations in a centralized log.json file, tracking: |
| 201 | +- Document creation and conversion |
| 202 | +- Script documentation |
| 203 | +- PII redaction |
| 204 | +- Security analysis |
| 205 | +- SEO optimization |
| 206 | +- Success rates and execution times |
161 | 207 |
|
162 | 208 | ### Error Resolution System |
163 | 209 | When errors occur during testing, ADA employs a sophisticated resolution system: |
164 | | -- Analyzes errors to determine if they originate in main document or dependency files |
165 | | -- Uses progressive troubleshooting strategies for persistent errors |
166 | | -- Only counts attempts against the maximum when fixing the main document |
167 | | -- Provides specific strategies for different error patterns |
| 210 | +- Analyzes error messages to determine their source |
| 211 | +- Uses progressive troubleshooting strategies |
| 212 | +- Provides specific fixes for different error patterns |
168 | 213 | - Remembers previous errors to avoid repetitive solutions |
169 | 214 |
|
170 | | -### Progressive Error Strategies |
171 | | -ADA uses increasingly more aggressive strategies when encountering repeated errors: |
172 | | -1. Target specific issues identified in error messages |
173 | | -2. Simplify complex code blocks into smaller, manageable steps |
174 | | -3. Remove problematic result blocks that may be causing validation issues |
175 | | -4. Try alternative commands or approaches to achieve the same result |
176 | | -5. Completely redesign problematic sections with simpler implementations |
177 | | -6. Remove and rebuild problematic sections from scratch |
| 215 | +## Requirements |
178 | 216 |
|
179 | | -## Logging |
180 | | -
|
181 | | -The script logs the following data to `execution_log.csv`: |
182 | | -
|
183 | | -- Timestamp: The date and time when the script was run. |
184 | | -- Type: The type of processing performed (file conversion, workload description, etc.). |
185 | | -- Input: The path to the input file or the workload description. |
186 | | -- Output: The path to the output file. |
187 | | -- Number of Attempts: The number of attempts made to generate a successful document. |
188 | | -- Errors Encountered: A summary of errors encountered during the process. |
189 | | -- Execution Time (in seconds): The total time taken to run the script. |
190 | | -- Success/Failure: Whether the script successfully generated a document without errors. |
| 217 | +ADA depends on the following Python packages: |
| 218 | +- azure-identity>=1.17.1 |
| 219 | +- beautifulsoup4>=4.12.2 |
| 220 | +- openai>=1.65.1 |
| 221 | +- requests>=2.31.0 |
| 222 | +- requests-kerberos>=0.12.0 |
| 223 | +- requests-ntlm>=1.1.0 |
| 224 | +- requests-toolbelt>=1.0.0 |
191 | 225 |
|
192 | 226 | ## License |
193 | 227 |
|
194 | 228 | This project is licensed under the MIT License - see the LICENSE file for details. |
195 | 229 |
|
196 | 230 | ## Contributing |
197 | 231 |
|
198 | | -Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests. |
199 | | -
|
200 | | -## Acknowledgments |
201 | | -
|
202 | | -- [OpenAI](https://openai.com/) |
203 | | -- [Azure](https://azure.microsoft.com/) |
| 232 | +Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests. |
0 commit comments