mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-10 15:50:37 +08:00
Merge pull request #349 from Codium-ai/tr/large_prs_readme
readme updates
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
# Git Patch Logic
|
# PR Compression Strategy
|
||||||
There are two scenarios:
|
There are two scenarios:
|
||||||
1. The PR is small enough to fit in a single prompt (including system and user prompt)
|
1. The PR is small enough to fit in a single prompt (including system and user prompt)
|
||||||
2. The PR is too large to fit in a single prompt (including system and user prompt)
|
2. The PR is too large to fit in a single prompt (including system and user prompt)
|
||||||
@ -16,7 +16,7 @@ We prioritize the languages of the repo based on the following criteria:
|
|||||||
## Small PR
|
## Small PR
|
||||||
In this case, we can fit the entire PR in a single prompt:
|
In this case, we can fit the entire PR in a single prompt:
|
||||||
1. Exclude binary files and non code files (e.g. images, pdfs, etc)
|
1. Exclude binary files and non code files (e.g. images, pdfs, etc)
|
||||||
2. We Expand the surrounding context of each patch to 6 lines above and below the patch
|
2. We Expand the surrounding context of each patch to 3 lines above and below the patch
|
||||||
## Large PR
|
## Large PR
|
||||||
|
|
||||||
### Motivation
|
### Motivation
|
||||||
@ -25,7 +25,7 @@ We want to be able to pack as much information as possible in a single LMM promp
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### PR compression strategy
|
#### Compression strategy
|
||||||
We prioritize additions over deletions:
|
We prioritize additions over deletions:
|
||||||
- Combine all deleted files into a single list (`deleted files`)
|
- Combine all deleted files into a single list (`deleted files`)
|
||||||
- File patches are a list of hunks, remove all hunks of type deletion-only from the hunks in the file patch
|
- File patches are a list of hunks, remove all hunks of type deletion-only from the hunks in the file patch
|
||||||
|
12
Usage.md
12
Usage.md
@ -7,6 +7,7 @@
|
|||||||
- [Working with GitHub App](#working-with-github-app)
|
- [Working with GitHub App](#working-with-github-app)
|
||||||
- [Working with GitHub Action](#working-with-github-action)
|
- [Working with GitHub Action](#working-with-github-action)
|
||||||
- [Changing a model](#changing-a-model)
|
- [Changing a model](#changing-a-model)
|
||||||
|
- [Working with large PRs](#working-with-large-prs)
|
||||||
- [Appendix - additional configurations walkthrough](#appendix---additional-configurations-walkthrough)
|
- [Appendix - additional configurations walkthrough](#appendix---additional-configurations-walkthrough)
|
||||||
|
|
||||||
### Introduction
|
### Introduction
|
||||||
@ -240,6 +241,17 @@ key = ...
|
|||||||
|
|
||||||
Also review the [AiHandler](pr_agent/algo/ai_handler.py) file for instruction how to set keys for other models.
|
Also review the [AiHandler](pr_agent/algo/ai_handler.py) file for instruction how to set keys for other models.
|
||||||
|
|
||||||
|
### Working with large PRs
|
||||||
|
|
||||||
|
The default mode of CodiumAI is to have a single call per tool, using GPT-4, which has a token limit of 8000 tokens.
|
||||||
|
This mode provide a very good speed-quality-cost tradeoff, and can handle most PRs successfully.
|
||||||
|
When the PR is above the token limit, it employs a [PR Compression strategy](./PR_COMPRESSION.md).
|
||||||
|
|
||||||
|
However, for very large PRs, or in case you want to emphasize quality over speed and cost, there are 2 possible solutions:
|
||||||
|
1) [Use a model](#changing-a-model) with larger context, like GPT-32K, or claude-100K. This solution will be applicable for all the tools.
|
||||||
|
2) For the `/improve` tool, there is an ['extended' mode](./docs/IMPROVE.md) (`/improve --extended`),
|
||||||
|
which divides the PR to chunks, and process each chunk separately. With this mode, regardless of the model, no compression will be done (but for large PRs, multiple model calls may occur)
|
||||||
|
|
||||||
### Appendix - additional configurations walkthrough
|
### Appendix - additional configurations walkthrough
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user