Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review prompt improvements #9

Closed
wants to merge 3 commits into from
Closed

Conversation

ravilushqa
Copy link
Owner

@ravilushqa ravilushqa commented May 7, 2023

Description

This pull request adds new functionality to generate GitHub pull request review comments based on an AI chatbot review of the diffs. The chatbot, named CodeReviewGPT, analyzes the structure and logic of code, identifies potential issues including bugs, security vulnerabilities, performance, readability, and maintainability, and provides developers with comprehensive feedback. For each file changed in the pull request, CodeReviewGPT adds comments to the respective line number in the pull request. Additionally, an overall review of the pull request is included.

Changes

  • Added functionality to generate GitHub pull request review comments based on an AI chatbot review of the diffs.
  • Added an embed package to the import section
  • Added a new variable PromptReview and assigned the value of assets/review.txt to it
  • PromptReview has been removed from PromptOverallReview
  • Updated the ChatCompletion function to set the temperature to 0.

File: cmd/review/main.go
Description: Added functionality to generate comments on a pull request based on an AI review of the code changes. The AI review identifies issues in the code changes and generates comments on the relevant lines of code. The comments are created as pull request comments and can be reviewed by the team. The overall review is also generated and can be added as a pull request review.

File: openai/assets/review.txt
Description: Added an embedded file assets/review.txt to the codebase for use in generating prompts for code review. The file contains a detailed report that includes specific recommendations, examples, and explanations to help developers improve their code. If context is not enough, the AI agent marks it as good. The responses are in JSON format and include quality values of good, bad, and neutral, and issue types including bug, security, performance, readability, maintainability, and other.

File: openai/openai.go
Description: Added a new constant PromptReview for generating a prompt for code review. Adjusted the ChatCompletion function to include a new parameter Temperature with a default value of 0.1.

@ravilushqa ravilushqa self-assigned this May 7, 2023
openai/openai.go Outdated
Messages: messages,
Model: openai.GPT3Dot5Turbo,
Messages: messages,
Temperature: 0,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[readability] Import statements could be grouped together to improve readability of the code.

openai/openai.go Outdated
Messages: messages,
Model: openai.GPT3Dot5Turbo,
Messages: messages,
Temperature: 0,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[performance] Setting temperature to 0 might affect the accuracy of chat completion results. It is recommended to use a value between 0.1 and 1.

@ravilushqa ravilushqa closed this May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant