mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 20:30:41 +08:00
62 lines
2.5 KiB
Markdown
62 lines
2.5 KiB
Markdown
![]() |
# Custom Suggestions Tool
|
||
|
|
||
|
## Table of Contents
|
||
|
- [Overview](#overview)
|
||
|
- [Example usage](#example-usage)
|
||
|
- [Configuration options](#configuration-options)
|
||
|
|
||
|
|
||
|
## Overview
|
||
|
The `custom_suggestions` tool scans the PR code changes, and automatically generates custom suggestions for improving the PR code.
|
||
|
It shares similarities with the `imrpove` tool, but with one main difference: the `custom_suggestions` tool will only propose suggestion that follow specific guidelines defined by the prompt in: `pr_custom_suggestions.prompt` configuration.
|
||
|
|
||
|
The tool can be triggered [automatically](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#github-app-automatic-tools) every time a new PR is opened, or can be invoked manually by commenting on a PR.
|
||
|
|
||
|
When commenting, use the following template:
|
||
|
|
||
|
```
|
||
|
/custom_suggestions --pr_custom_suggestions.prompt="The suggestions should focus only on the following:\n-...\n-...\n-..."
|
||
|
```
|
||
|
|
||
|
With a [configuration file](https://github.com/Codium-ai/pr-agent/blob/main/Usage.md#working-with-github-app), use the following template:
|
||
|
|
||
|
```
|
||
|
[pr_custom_suggestions]
|
||
|
prompt="""\
|
||
|
The suggestions should focus only on the following:
|
||
|
-...
|
||
|
-...
|
||
|
-...
|
||
|
"""
|
||
|
```
|
||
|
Using a configuration file is recommended, since it allows to use multi-line instructions.
|
||
|
|
||
|
Don't forget - with this tool, you are the prompter. Be specific, clear, and concise in the instructions. Specify relevant aspects that you want the model to focus on. \
|
||
|
You might benefit from several trial-and-error iterations, until you get the correct prompt for your use case.
|
||
|
|
||
|
## Example usage
|
||
|
|
||
|
Here is an example for a possible prompt:
|
||
|
```
|
||
|
[pr_custom_suggestions]
|
||
|
prompt="""\
|
||
|
The suggestions should focus only on the following:
|
||
|
- look for edge cases when implementing a new function
|
||
|
- make sure every variable has a meaningful name
|
||
|
- make sure the code is efficient
|
||
|
"""
|
||
|
```
|
||
|
|
||
|
The instructions above are just an example. We want to emphasize that the prompt should be specific and clear, and be tailored to the needs of your project.
|
||
|
|
||
|
Results obtained with the prompt above:
|
||
|
___
|
||
|
<kbd><img src=https://codium.ai/images/pr_agent/custom_suggestions_prompt.png width="512"></kbd>
|
||
|
___
|
||
|
<kbd><img src=https://codium.ai/images/pr_agent/custom_suggestions_result.png width="768"></kbd>
|
||
|
___
|
||
|
|
||
|
## Configuration options
|
||
|
`prompt`: the prompt for the tool. Should be a multi-line string.
|
||
|
`num_code_suggestions`: number of code suggestions provided by the 'custom_suggestions' tool. Default is 4.
|
||
|
`enable_help_text`: if set to true, the tool will display a help text in the comment. Default is true.
|