...
Get your API key from your AI provider.
For you get the API key OpenAI by going here.
Go to the Code Review Assistant settings page of your repository
Select the AI Provider: OpenAI or another AI Provider
For other AI providers, like Azure, provide the API URL for the chat completion API.
Contact our support for AI providers not yet supported.
Select a model supported by your API Key, and copy-paste your key in the input field.
Click on “Save”. You should see a confirmation flag that your data as been updated.
...
Usage
You can interact with the AI Review Assistant directly in your pull request. To do so, write a comment in the view of your pull request starting by /aira
(short for AI Review Assistant) followed by your question for the AI. The AI service will receive the information related to your pull request (current title, description, commit titles, the diff and comments of the existing thread), followed by your question.
...
Some examples to get you started (see also below for more examples):
/aira What is the purpose of this change?
/aira Are there any password or PII information that leaked in this pull request?
/aira Can you write a description for this pull request?
...
It is possible to have the AI Review Assistant perform reviews of your pull requests automatically. To achieve that, you need to configure your pull request to create an automatic comment. This comment should begin with the standard /aira
prefix, followed by a question requesting a review. You can accomplish this in two ways: by utilizing Default tasks from Bitbucket, or using the Checklist Buddy plugin for Bitbucket.
Using Default tasks
In your repository settings, go to Default tasks
...
Click on Add a default task.
...
Fill in the Default task description with a prompt starting by
/aira
...
See figure below for an example.
...
As any tool based on ChatGPT (or similar technologies), you can ask about anything to it and it will respond. However, it takes a bit of practice to know how to ask questions the right way. These questions are called prompts in the context of AI. Below, we Let’s walk you through some examples that have brought some success in our internal usage.
1. Ask about facts
AI Review Assistant will be good at scanning your pull requests for particular facts that a human can easily double-check. The following questions can be applied automatically to any pull request.
/aira Make a list of all files and line numbers where there is a password in plain-text in this Pull Request
/aira Make a list of all files and line numbers where PII information might leak from the code in this Pull Request
/aira Make a list of any inconsistencies between inline comments in the codescode, and the implementation, or the description of this Pull Request?
...
AI Review Assistant will also respond in case there is another issue with your request (for example, API Key is not properly configured). If, however, nothing happens after 2 minutes, this indicates that there is an unknown issue, and you should contact an Administrator.
Can I make the AI only look at a smaller part of the Pull Request?
By default, when writing a comment to the AI Review Assistant (or responding to a comment where it is involved), AI Review Assistant receives the exhaustive diff of the Pull Request.
It is however possible to narrow down the scope on demand. This helps avoiding errors about context too large for larger pull requests.
To do that, respond to an AI comment by a comment starting with Context:
, then the list of files (with complete path from the repository root), with one file per line. Such a comment would look like the following:
Code Block |
---|
Context:
path/to/file1.txt
path/to/file2.py |
You can see an example in action below:
...