forked from MicrosoftDocs/executable-docs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made tool for easier authoring experience with exec docs using AI - s…
…tored it in the tools folder
- Loading branch information
1 parent
3a2d7af
commit b74cde5
Showing
2 changed files
with
494 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Exec Docs Agent | ||
|
||
Welcome to Exec Docs Agent! This tool helps you convert documents and troubleshoot errors efficiently using OpenAI's Large Language Models and the Azure Innovation Engine. | ||
|
||
## Features | ||
|
||
- Converts input documents using OpenAI's LLMs. | ||
- Automatically installs required packages and the Innovation Engine. | ||
- Runs tests on the converted document using the Innovation Engine. | ||
- Provides detailed error logs and generates troubleshooting steps. | ||
- Logs execution data to a CSV file for analytics. | ||
|
||
## Prerequisites | ||
|
||
- Python 3.6 or higher | ||
- An Azure OpenAI API key | ||
- A GitHub access token | ||
- Required Python packages: `openai`, `azure-identity`, `requests`, `pygithub` | ||
|
||
## Installation | ||
|
||
1. Clone the repository: | ||
```bash | ||
git clone <repository-url> | ||
cd <repository-directory> | ||
``` | ||
|
||
2. Install the required Python packages: | ||
```bash | ||
pip install openai azure-identity requests pygithub | ||
``` | ||
|
||
3. Ensure you have the Azure OpenAI API key and GitHub access token set as environment variables: | ||
```bash | ||
export AZ | ||
URE | ||
_OPENAI_API_KEY=<your-azure-openai-api-key> | ||
export AZURE_OPENAI_ENDPOINT=<your-azure-openai-endpoint> | ||
export GitHub_Token=<your-github-access-token> | ||
``` | ||
|
||
## Usage | ||
|
||
1. Run the script: | ||
```bash | ||
python ada.py | ||
``` | ||
|
||
2. Enter the path to the file you want to convert when prompted. | ||
|
||
## Script Workflow | ||
|
||
1. **Initialization**: The script initializes the Azure OpenAI client and checks for required packages. | ||
2. **Input File**: Prompts the user to enter the path to the input file. | ||
3. **System Prompt**: Loads the system prompt from `create.txt`. | ||
4. **File Content**: Reads the content of the input file. | ||
5. **Install Innovation Engine**: Checks if the Innovation Engine is installed and installs it if necessary. | ||
6. **Conversion and Testing**: | ||
- Attempts to convert the document using OpenAI's GPT-4 model. | ||
- Runs tests on the converted document using the Innovation Engine. | ||
- If tests fail, generates troubleshooting steps and attempts to correct the document. | ||
7. **Remove Backticks**: Ensures the first and last lines of the converted document do not contain backticks. | ||
8. **Logging**: Logs execution data to `execution_log.csv`. | ||
## Logging | ||
The script logs the following data to `execution_log.csv`: | ||
- Timestamp: The date and time when the script was run. | ||
- Input File Path: The path to the input file. | ||
- Output File Path: The path to the output file. | ||
- Number of Attempts: The number of attempts made to generate a successful document. | ||
- Errors Encountered: A summary of errors encountered during the process. | ||
- Chain of Thoughts: The troubleshooting steps generated by the model. | ||
- Execution Time: The total time taken to run the script. | ||
- Success/Failure: Whether the script successfully generated a document without errors. | ||
## License | ||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | ||
## Contributing | ||
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests. | ||
## Acknowledgments | ||
- [OpenAI](https://openai.com/) | ||
- [Azure](https://azure.microsoft.com/) | ||
- [GitHub](https://github.com/) |
Oops, something went wrong.