Refine field descriptions in pr_code_suggestions_prompts.toml and comment out default scoring error log in pr_code_suggestions.py

This commit is contained in:
mrT23
2024-05-16 21:49:06 +03:00
parent 570f7d6dcf
commit cc08394e51
2 changed files with 3 additions and 3 deletions

View File

@ -59,8 +59,8 @@ class CodeSuggestion(BaseModel):
relevant_file: str = Field(description="the relevant file full path") relevant_file: str = Field(description="the relevant file full path")
language: str = Field(description="the code language of the relevant file") language: str = Field(description="the code language of the relevant file")
suggestion_content: str = Field(description="an actionable suggestion for meaningfully improving the new code introduced in the PR") suggestion_content: str = Field(description="an actionable suggestion for meaningfully improving the new code introduced in the PR")
existing_code: str = Field(description="a short code snippet from a '__new hunk__' section to illustrate the relevant existing code. Don't show the line numbers.") existing_code: str = Field(description="a short code snippet, demonstrating the relevant code lines from a '__new hunk__' section. It must without line numbers. Use abbreviations if needed")
improved_code: str = Field(description="a short code snippet to illustrate the improved code, after applying the suggestion.") improved_code: str = Field(description="a new code snippet, that can be used to replace the relevant 'existing_code' lines in '__new hunk__' code after applying the suggestion")
one_sentence_summary:str = Field(description="a short summary of the suggestion action, in a single sentence. Focus on the 'what'. Be general, and avoid method or variable names.") one_sentence_summary:str = Field(description="a short summary of the suggestion action, in a single sentence. Focus on the 'what'. Be general, and avoid method or variable names.")
relevant_lines_start: int = Field(description="The relevant line number, from a '__new hunk__' section, where the suggestion starts (inclusive). Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above") relevant_lines_start: int = Field(description="The relevant line number, from a '__new hunk__' section, where the suggestion starts (inclusive). Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above")
relevant_lines_end: int = Field(description="The relevant line number, from a '__new hunk__' section, where the suggestion ends (inclusive). Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above") relevant_lines_end: int = Field(description="The relevant line number, from a '__new hunk__' section, where the suggestion ends (inclusive). Should be derived from the hunk line numbers, and correspond to the 'existing code' snippet above")

View File

@ -196,7 +196,7 @@ class PRCodeSuggestions:
suggestion["score"] = 7 suggestion["score"] = 7
suggestion["score_why"] = "" suggestion["score_why"] = ""
else: else:
get_logger().error(f"Could not self-reflect on suggestions. using default score 7") # get_logger().error(f"Could not self-reflect on suggestions. using default score 7")
for i, suggestion in enumerate(data["code_suggestions"]): for i, suggestion in enumerate(data["code_suggestions"]):
suggestion["score"] = 7 suggestion["score"] = 7
suggestion["score_why"] = "" suggestion["score_why"] = ""