mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 21:30:40 +08:00
feat: add example output duplication option for code suggestions prompts
This commit is contained in:
@ -48,8 +48,8 @@ api_base = "http://localhost:11434" # or whatever port you're running Ollama on
|
|||||||
|
|
||||||
!!! note "Local models vs commercial models"
|
!!! note "Local models vs commercial models"
|
||||||
Qodo Merge is compatible with almost any AI model, but analyzing complex code repositories and pull requests requires a model specifically optimized for code analysis.
|
Qodo Merge is compatible with almost any AI model, but analyzing complex code repositories and pull requests requires a model specifically optimized for code analysis.
|
||||||
Commercial models such as GPT-4, Claude Sonnet, and Gemini have demonstrated robust capabilities in generating structured output for code analysis. In contrast, most open-source models currently available (as of January 2025) face challenges with these complex tasks.
|
Commercial models such as GPT-4, Claude Sonnet, and Gemini have demonstrated robust capabilities in generating structured output for code analysis tasks with large input. In contrast, most open-source models currently available (as of January 2025) face challenges with these complex tasks.
|
||||||
Based on our testing, local open-source models are suitable for experimentation and learning purposes, but they may not be suitable for production-level code analysis tasks.
|
Based on our testing, local open-source models are suitable for experimentation and learning purposes, but they are not suitable for production-level code analysis tasks.
|
||||||
Hence, for production workflows and real-world code analysis, we recommend using commercial models.
|
Hence, for production workflows and real-world code analysis, we recommend using commercial models.
|
||||||
|
|
||||||
### Hugging Face Inference Endpoints
|
### Hugging Face Inference Endpoints
|
||||||
|
@ -125,6 +125,30 @@ The PR Diff:
|
|||||||
{{ diff_no_line_numbers|trim }}
|
{{ diff_no_line_numbers|trim }}
|
||||||
======
|
======
|
||||||
|
|
||||||
|
{%- if duplicate_prompt_examples %}
|
||||||
|
|
||||||
|
|
||||||
|
Example output:
|
||||||
|
```yaml
|
||||||
|
code_suggestions:
|
||||||
|
- relevant_file: |
|
||||||
|
src/file1.py
|
||||||
|
language: |
|
||||||
|
python
|
||||||
|
suggestion_content: |
|
||||||
|
...
|
||||||
|
existing_code: |
|
||||||
|
...
|
||||||
|
improved_code: |
|
||||||
|
...
|
||||||
|
one_sentence_summary: |
|
||||||
|
...
|
||||||
|
label: |
|
||||||
|
...
|
||||||
|
```
|
||||||
|
(replace '...' with actual content)
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
|
||||||
Response (should be a valid YAML, and nothing else):
|
Response (should be a valid YAML, and nothing else):
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -122,6 +122,25 @@ Below are {{ num_code_suggestions }} AI-generated code suggestions for enhancing
|
|||||||
======
|
======
|
||||||
|
|
||||||
|
|
||||||
|
{%- if duplicate_prompt_examples %}
|
||||||
|
|
||||||
|
|
||||||
|
Example output:
|
||||||
|
```yaml
|
||||||
|
code_suggestions:
|
||||||
|
- suggestion_summary: |
|
||||||
|
...
|
||||||
|
relevant_file: "..."
|
||||||
|
relevant_lines_start: ...
|
||||||
|
relevant_lines_end: ...
|
||||||
|
suggestion_score: ...
|
||||||
|
why: |
|
||||||
|
...
|
||||||
|
- ...
|
||||||
|
```
|
||||||
|
(replace '...' with actual content)
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
Response (should be a valid YAML, and nothing else):
|
Response (should be a valid YAML, and nothing else):
|
||||||
```yaml
|
```yaml
|
||||||
"""
|
"""
|
||||||
|
@ -81,6 +81,7 @@ class PRCodeSuggestions:
|
|||||||
"relevant_best_practices": "",
|
"relevant_best_practices": "",
|
||||||
"is_ai_metadata": get_settings().get("config.enable_ai_metadata", False),
|
"is_ai_metadata": get_settings().get("config.enable_ai_metadata", False),
|
||||||
"focus_only_on_problems": get_settings().get("pr_code_suggestions.focus_only_on_problems", False),
|
"focus_only_on_problems": get_settings().get("pr_code_suggestions.focus_only_on_problems", False),
|
||||||
|
'duplicate_prompt_examples': get_settings().config.get('duplicate_prompt_examples', False),
|
||||||
}
|
}
|
||||||
self.pr_code_suggestions_prompt_system = get_settings().pr_code_suggestions_prompt.system
|
self.pr_code_suggestions_prompt_system = get_settings().pr_code_suggestions_prompt.system
|
||||||
|
|
||||||
@ -830,7 +831,8 @@ class PRCodeSuggestions:
|
|||||||
"diff": patches_diff,
|
"diff": patches_diff,
|
||||||
'num_code_suggestions': len(suggestion_list),
|
'num_code_suggestions': len(suggestion_list),
|
||||||
'prev_suggestions_str': prev_suggestions_str,
|
'prev_suggestions_str': prev_suggestions_str,
|
||||||
"is_ai_metadata": get_settings().get("config.enable_ai_metadata", False)}
|
"is_ai_metadata": get_settings().get("config.enable_ai_metadata", False),
|
||||||
|
'duplicate_prompt_examples': get_settings().config.get('duplicate_prompt_examples', False)}
|
||||||
environment = Environment(undefined=StrictUndefined)
|
environment = Environment(undefined=StrictUndefined)
|
||||||
|
|
||||||
if dedicated_prompt:
|
if dedicated_prompt:
|
||||||
|
Reference in New Issue
Block a user