Use your own Azure OpenAI service endpoints to provide pull request code reviews while keeping your code private.
- AI Powered Insights: Optimized for latest LLM models like GPT-4o-mini, which provides optimal high performance with small cost.
- Security and Privacy: Use your own Azure OpenAI model deployment for reviews
- Automated Summaries: Let AI summarise your pull request so it's easier for humans to follow. AI will also provide feedback for all changes related to bugs, performance, best practices etc.
- Easy to install: A simple one-click installation from the Azure DevOps Marketplace gets you up and running instantly. Configure to your pipeline as shown below.
- Faster Reviews: Reduce the time spent on code reviews. Let Open AI handle the routine, allowing your team to focus on impactful work.
- Configurable and Customizable: Tailor the extension to your needs with customizable settings. Specify the Open AI model, define file exclusions, and more.
Click for larger version:
The extension itself is free. The reviews will utilize your own Azure OpenAI services so it will depend on the model that you deploy. As of today October 2024 the GPT-4o-mini seems to be optimal for this purpose and is cheap to use - today price for input prompt was $0.15 per 1M tokens, output was $0.60 per 1M tokens. While completing many pull requests the price per code review ranges from ~$0.0002 to ~$0.002 per review - so if you have 1000 PRs per month it's a price of coffee 😉
You can set the token pricing on the task parameters and then you can see from your logs how much each of the reviews cost:
- Azure DevOps Account
- Azure OpenAI endpoint URI
- Azure OpenAI endpoint key
- Optional: Pricing for input and output tokens (check from Azure OpenAI Pricing)
- Install the AI Code Review DevOps Extension from the Azure DevOps Marketplace.
- Add Open AI Code Review Task to Your Pipeline:
trigger:
branches:
exclude:
- '*'
pr:
branches:
include:
- '*'
jobs:
- job: CodeReview
pool:
vmImage: 'ubuntu-latest'
steps:
- task: AICodeReview@1
inputs:
azureOpenAiDeploymentEndpointUrl: $(AzureOpenAiDeploymentEndpoint)
azureOpenAiApiKey: $(AzureOpenAiDeploymentKey)
azureOpenAiApiVersion: "2024-07-01-preview"
promptTokensPricePerMillionTokens: "0.15"
completionTokensPricePerMillionTokens: "0.6"
addCostToComments: true
reviewBugs: true
reviewPerformance: true
reviewBestPractices: true
reviewWholeDiffAtOnce: true
maxTokens: 16384
fileExtensions: '.js,.ts,.css,.html,.py,.tf'
fileExcludes: 'file1.js,file2.py,secret.txt'
additionalPrompts: |
Fix variable naming, Ensure consistent indentation, Review error handling approach, Check for OWASP best practices
- If you do not already have Build Validation configured for your branch already add Build validation to your branch policy to trigger the code review when a Pull Request is created
A: Ensure that "Allow scripts to access OAuth token" is enabled as part of the agent job. Follow the documentation for more details.
A: Build Administrators must be given "Contribute to pull requests" access. Check this Stack Overflow answer for guidance on setting up permissions.
If you find a bug or unexpected behavior, please open a bug report.
If you have ideas for new features or enhancements, please submit a feature request.
This project is licensed under the MIT License.
If you would like to contribute to the development of this extension, please follow our contribution guidelines.
Project was originally forked from a1dancole/OpenAI-Code-Review.