|
| 1 | +# ADA - AI Documentation Assistant |
| 2 | + |
| 3 | +ADA (AI Documentation Assistant) helps you create, convert, and manage Executable Documents efficiently using Azure OpenAI and Innovation Engine. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 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 |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +- Python 3.6 or higher |
| 20 | +- Azure OpenAI API key and endpoint |
| 21 | +- Docker (optional, for containerized usage) |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +### Option 1: Local Installation |
| 26 | + |
| 27 | +1. Clone the repository: |
| 28 | + ```bash |
| 29 | + git clone <repository-url> |
| 30 | + cd <repository-directory>/tools |
| 31 | + ``` |
| 32 | + |
| 33 | +2. Install the required Python packages: |
| 34 | + ```bash |
| 35 | + pip install -r requirements.txt |
| 36 | + ``` |
| 37 | + |
| 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 | + ``` |
| 43 | + |
| 44 | + To obtain an Azure OpenAI API key and endpoint, follow these steps: |
| 45 | + |
| 46 | + 1. **Sign in to the Azure Portal**: |
| 47 | + - Navigate to [https://portal.azure.com](https://portal.azure.com) and log in with your Azure credentials. |
| 48 | + |
| 49 | + 2. **Create an Azure OpenAI Resource**: |
| 50 | + - In the Azure Portal, select "Create a resource". |
| 51 | + - Search for "Azure OpenAI" and select it from the results. |
| 52 | + - Click "Create" to begin the setup process. |
| 53 | + - Fill in the required details: |
| 54 | + - **Subscription**: Choose your Azure subscription. |
| 55 | + - **Resource Group**: Select an existing resource group or create a new one. |
| 56 | + - **Region**: Choose the region closest to your location. |
| 57 | + - **Name**: Provide a unique name for your Azure OpenAI resource. |
| 58 | + - **Pricing Tier**: Select the appropriate pricing tier (e.g., Standard S0). |
| 59 | + - Click "Review + create" and then "Create" to deploy the resource. |
| 60 | + |
| 61 | + 3. **Deploy a Model in Azure AI Studio**: |
| 62 | + - After creating your Azure OpenAI resource, navigate to the **Overview** page of your resource. |
| 63 | + - Click on "Go to Azure AI Studio" to open the Azure AI Studio interface. |
| 64 | + - In Azure AI Studio, select "Deployments" from the left-hand menu. |
| 65 | + - Click "Deploy model" and choose `gpt-4.1` from the Azure OpenAI collection. |
| 66 | + - Provide a deployment name and configure any additional settings as needed. |
| 67 | + - Click "Deploy" to deploy the model. |
| 68 | + |
| 69 | + 4. **Access Keys and Endpoint**: |
| 70 | + - Once the deployment is complete, return to your Azure OpenAI resource in the Azure Portal. |
| 71 | + - In the left-hand menu under "Resource Management", select "Keys and Endpoint". |
| 72 | + - Here, you'll find your **Endpoint** URL and two **API keys** (`KEY1` and `KEY2`). |
| 73 | + - Copy the endpoint URL and one of the API keys; you'll need them to authenticate your API calls. |
| 74 | + |
| 75 | + 5. **Set Environment Variables in Linux**: |
| 76 | + - Open your terminal. |
| 77 | + - Edit the [.bashrc](http://_vscodecontentref_/2) file using a text editor, such as `nano`: |
| 78 | + ```bash |
| 79 | + nano ~/.bashrc |
| 80 | + ``` |
| 81 | + - Add the following lines at the end of the file, replacing `<your_api_key>` and `<your_endpoint>` with the values you obtained earlier: |
| 82 | + ```bash |
| 83 | + export AZURE_OPENAI_API_KEY="<your_api_key>" |
| 84 | + export AZURE_OPENAI_ENDPOINT="<your_endpoint>" |
| 85 | + ``` |
| 86 | + - Save and exit the editor (`Ctrl + X`, then `Y`, and `Enter` for nano). |
| 87 | + - Apply the changes by sourcing the [.bashrc](http://_vscodecontentref_/3) file: |
| 88 | + ```bash |
| 89 | + source ~/.bashrc |
| 90 | + ``` |
| 91 | + - To verify that the environment variables are set correctly, you can use the `printenv` command: |
| 92 | + ```bash |
| 93 | + printenv | grep AZURE_OPENAI |
| 94 | + ``` |
| 95 | + This should display the variables you just set. |
| 96 | + |
| 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. |
| 98 | +
|
| 99 | + For a visual walkthrough of creating an Azure OpenAI resource and deploying a model, you might find the following video helpful: |
| 100 | +
|
| 101 | +4. Run ADA: |
| 102 | + ```bash |
| 103 | + python ada.py |
| 104 | + ``` |
| 105 | +
|
| 106 | +### Option 2: Docker Installation |
| 107 | +
|
| 108 | +1. Build the Docker image: |
| 109 | + ```bash |
| 110 | + docker build -t ada-tool . |
| 111 | + ``` |
| 112 | +
|
| 113 | +2. Run ADA in a Docker container: |
| 114 | + ```bash |
| 115 | + docker run -it --rm \ |
| 116 | + -e AZURE_OPENAI_API_KEY="your_api_key_here" \ |
| 117 | + -e AZURE_OPENAI_ENDPOINT="your_endpoint_here" \ |
| 118 | + -v "$(pwd):/app/workspace" \ |
| 119 | + -v "$HOME/.azure:/root/.azure" \ |
| 120 | + -w /app/workspace \ |
| 121 | + ada-tool |
| 122 | + ``` |
| 123 | +
|
| 124 | +3. Run ADA: |
| 125 | + ```bash |
| 126 | + ./run-ada.sh |
| 127 | + ``` |
| 128 | +## Usage |
| 129 | +
|
| 130 | +1. 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 | +2. 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 | +## Advanced Features |
| 161 | +
|
| 162 | +### Centralized Logging |
| 163 | +ADA maintains a comprehensive log of all operations in a centralized log.json file, tracking: |
| 164 | +- Document creation and conversion |
| 165 | +- Script documentation |
| 166 | +- PII redaction |
| 167 | +- Security analysis |
| 168 | +- SEO optimization |
| 169 | +- Success rates and execution times |
| 170 | +
|
| 171 | +### Error Resolution System |
| 172 | +When errors occur during testing, ADA employs a sophisticated resolution system: |
| 173 | +- Analyzes error messages to determine their source |
| 174 | +- Uses progressive troubleshooting strategies |
| 175 | +- Provides specific fixes for different error patterns |
| 176 | +- Remembers previous errors to avoid repetitive solutions |
| 177 | +
|
| 178 | +## Requirements |
| 179 | +
|
| 180 | +ADA depends on the following Python packages: |
| 181 | +- azure-identity>=1.17.1 |
| 182 | +- beautifulsoup4>=4.12.2 |
| 183 | +- openai>=1.65.1 |
| 184 | +- requests>=2.31.0 |
| 185 | +- requests-kerberos>=0.12.0 |
| 186 | +- requests-ntlm>=1.1.0 |
| 187 | +- requests-toolbelt>=1.0.0 |
| 188 | +
|
| 189 | +## License |
| 190 | +
|
| 191 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 192 | +
|
| 193 | +## Contributing |
| 194 | +
|
| 195 | +Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests. |
0 commit comments