From 01dcd00428c30ce1d47099bca85ba0aa0bd7c158 Mon Sep 17 00:00:00 2001 From: Saurav Panda Date: Thu, 23 May 2024 00:36:09 -0400 Subject: [PATCH] feat: updated the prompt output format --- kaizen/helpers/output.py | 6 ++++++ kaizen/llms/prompts.py | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/kaizen/helpers/output.py b/kaizen/helpers/output.py index 46802c14..bef93971 100644 --- a/kaizen/helpers/output.py +++ b/kaizen/helpers/output.py @@ -14,7 +14,9 @@ PR_COLLAPSIBLE_TEMPLATE = """
[{confidence}] -> {reasoning} +{file_name} | {start_line} - {end_line}
+ """ DESC_COLLAPSIBLE_TEMPLATE = """ @@ -22,6 +24,7 @@ Original Description {desc} + """ @@ -47,6 +50,9 @@ def create_pr_review_from_json(reviews): comment=review.get("comment", "NA"), reasoning=review.get("reasoning", "NA"), confidence=review.get("confidence", "NA"), + start_line=review.get("start_line", "NA"), + end_line=review.get("end_line", "NA"), + file_name=review.get("file_name", "NA"), ) markdown_output += ct + "\n" diff --git a/kaizen/llms/prompts.py b/kaizen/llms/prompts.py index 38b2a413..64244f38 100644 --- a/kaizen/llms/prompts.py +++ b/kaizen/llms/prompts.py @@ -18,7 +18,10 @@ "topic": "", "comment": "", "confidence": , - "reasoning": "" + "reasoning": "", + "start_line": "", + "end_line": "", + "file_name": "", }}, ... ] @@ -40,7 +43,7 @@ - "Improvements" Generate all possible feedbacks. -For each piece of feedback, clearly reference the specific file(s) and line number(s) of code being addressed. Use markdown code blocks to quote relevant snippets of code when necessary. +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. INFORMATION: @@ -63,7 +66,10 @@ "topic": "", "comment": "", "confidence": , - "reasoning": "" + "reasoning": "", + "start_line": "", + "end_line": "", + "file_name": "", }}, ... ] @@ -85,7 +91,7 @@ - "Improvements" Generate all possible feedbacks. -For each piece of feedback, clearly reference the specific file(s) and line number(s) of code being addressed. Use markdown code blocks to quote relevant snippets of code when necessary. +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. INFORMATION: