From 49e324aab58cf7b4ae196ec4765dd8e8d6182beb Mon Sep 17 00:00:00 2001 From: Saurav Panda Date: Mon, 27 May 2024 01:04:36 -0400 Subject: [PATCH] fix: updated prompt to make feedback more concise --- kaizen/llms/prompts.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/kaizen/llms/prompts.py b/kaizen/llms/prompts.py index 64244f38..b51ae59e 100644 --- a/kaizen/llms/prompts.py +++ b/kaizen/llms/prompts.py @@ -8,17 +8,15 @@ CODE_REVIEW_PROMPT = """ You are an experienced software engineer tasked with reviewing a pull request. -Your goal is to provide a comprehensive code review that evaluates the code changes, identifies potential issues, -and provides constructive feedback to the developer. +Your goal is to provide a concise and actionable code review that evaluates the code changes, identifies potential issues, and provides constructive feedback to the developer. -Using the provided information, generate a detailed code review with feedback organized as a JSON object. Only include sections with relevant feedback, omitting sections without feedback. Follow this structure: +Using the provided information, generate a code review with feedback organized as a JSON object. Only include sections with relevant feedback, omitting sections without feedback. Follow this structure: {{ "review": [ {{ "topic": "", - "comment": "", + "comment": "", "confidence": , - "reasoning": "", "start_line": "", "end_line": "", "file_name": "", @@ -42,9 +40,12 @@ - "Potential Issues" - "Improvements" -Generate all possible feedbacks. +Generate all relevant and actionable feedback. For each piece of feedback, clearly reference the specific file(s) and line number(s) of code being addressed for each comment. Use markdown code blocks to quote relevant snippets of code when necessary. -Keep comments short but make sure it has actionable points pointing to the code or line having the issue. Avoid duplicate feedback, merge when necessary. +Keep comments concise but make sure they have actionable points pointing to the code or line having the issue. Avoid duplicate feedback, merge when necessary. + +If there is no feedback, return an empty JSON object: {{"review": []}} + INFORMATION: Pull Request Title: {PULL_REQUEST_TITLE} @@ -56,17 +57,15 @@ FILE_CODE_REVIEW_PROMPT = """ You are an experienced software engineer tasked with reviewing a pull request. -Your goal is to provide a comprehensive code review that evaluates the code changes, identifies potential issues or areas for improvement, -and provides constructive feedback to the developer. +Your goal is to provide a concise and actionable code review that evaluates the code changes, identifies potential issues, and provides constructive feedback to the developer. -Using the provided information, generate a detailed code review with feedback organized as a JSON object. Only include sections with relevant feedback, omitting sections without feedback. Follow this structure: +Using the provided information, generate a code review with feedback organized as a JSON object. Only include sections with relevant feedback, omitting sections without feedback. Follow this structure: {{ "review": [ {{ "topic": "", - "comment": "", + "comment": "", "confidence": , - "reasoning": "", "start_line": "", "end_line": "", "file_name": "", @@ -90,9 +89,12 @@ - "Potential Issues" - "Improvements" -Generate all possible feedbacks. +Generate all relevant and actionable feedback. For each piece of feedback, clearly reference the specific file(s) and line number(s) of code being addressed for each comment. Use markdown code blocks to quote relevant snippets of code when necessary. -Keep comments short but make sure it has actionable points pointing to the code or line having the issue. Avoid duplicate feedback, merge when necessary. +Keep comments concise but make sure they have actionable points pointing to the code or line having the issue. Avoid duplicate feedback, merge when necessary. + +If there is no feedback, return an empty JSON object: {{"review": []}} + INFORMATION: Pull Request Title: {PULL_REQUEST_TITLE}