Skip to content

Commit

Permalink
feat: testing anthropic version
Browse files Browse the repository at this point in the history
  • Loading branch information
gwilkes-rv committed Oct 12, 2024
1 parent 393345c commit d883838
Show file tree
Hide file tree
Showing 19 changed files with 29,695 additions and 23,358 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/redrover_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ jobs:
- uses: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
with:
debug: false
debug: true
poem_enabled: true
less_verbose_review: false
review_comment_lgtm: false
openai_heavy_model: gpt-4
path_filters: |
!dist/**
!**/*.lock
system_message: ${{ steps.file.outputs.content }}
# system_message: ${{ steps.file.outputs.content }}
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ The MIT License (MIT)

Copyright (c) 2023 FluxNinja, Inc.
Copyright (c) 2023 Tao He
Copyright (c) 2023 tmokmss

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
51 changes: 12 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# RedRover - An OpenAI ChatGPT-based PR reviewer and summarizer
<h1><img align="center" height="60" src="https://github.com/user-attachments/assets/84111c2e-fe44-4de1-b82d-45f38199724a"> &nbsp;&nbsp;Red Rover</h1>

![small-red-rover](https://github.com/bankrate/red-rover/assets/64108082/9ee5df3f-bc3f-4bfc-878e-171d7ccca96e)
<br/>

## Overview

RedRover is an AI-based code reviewer and summarizer for
GitHub pull requests using OpenAI's `gpt-3.5-turbo` and `gpt-4` models. It is
GitHub pull requests using Anthropic models. It is
designed to be used as a GitHub Action and can be configured to run on every
pull request and review comments

Expand All @@ -18,13 +18,11 @@ pull request and review comments
- **Continuous, incremental reviews**: Reviews are performed on each commit
within a pull request, rather than a one-time review on the entire pull
request.
- **Cost-effective and reduced noise**: Incremental reviews save on OpenAI costs
- **Cost-effective and reduced noise**: Incremental reviews save on Anthropic costs
and reduce noise by tracking changed files between commits and the base of the
pull request.
- **"Light" model for summary**: Designed to be used with a "light"
summarization model (e.g. `gpt-3.5-turbo`) and a "heavy" review model (e.g.
`gpt-4`). _For best results, use `gpt-4` as the "heavy" model, as thorough
code review needs strong reasoning abilities._
summarization model and a "heavy" review model.
- **Chat with bot**: Supports conversation with the bot in the context of lines
of code or entire files, useful for providing context, generating test cases,
and reducing code complexity.
Expand All @@ -42,14 +40,13 @@ pull request and review comments

To use this tool, you need to add the provided YAML file to your repository and
configure the required environment variables, such as `GITHUB_TOKEN` and
`OPENAI_API_KEY`. For more information on usage, examples, and development
`ANTHROPIC_API_KEY`. For more information on usage, examples, and development
you can refer to the sections below.

- [Overview](#overview)
- [Professional Version of RedRover](#professional-version-of-RedRover)
- [Reviewer Features](#reviewer-features)
- [Install instructions](#install-instructions)
- [Conversation with RedRover](#conversation-with-RedRover)
- [Conversation with RedRover(#conversation-with-RedRover)
- [Examples](#examples)
- [Developing](#developing)

Expand Down Expand Up @@ -81,10 +78,10 @@ jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: RedVentures/red-rover@latest
- uses: RedVentures/red-rover@anthropic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
with:
debug: false
review_simple_changes: false
Expand All @@ -95,22 +92,9 @@ jobs:
- `GITHUB_TOKEN`: This should already be available to the GitHub Action
environment. This is used to add comments to the pull request.
- `OPENAI_API_KEY`: use this to authenticate with OpenAI API. You can get one
[here](https://platform.openai.com/account/api-keys). Please add this key to
- `ANTHROPIC_API_KEY`: use this to authenticate with Anthropic API. You can get one
[here](https://console.anthropic.com/settings/keys). Please add this key to
your GitHub Action secrets.
- `OPENAI_API_ORG`: (optional) use this to use the specified organization with
OpenAI API if you have multiple. Please add this key to your GitHub Action
secrets.

### Models: `gpt-4` and `gpt-3.5-turbo`

Recommend using `gpt-3.5-turbo` for lighter tasks such as summarizing the
changes (`openai_light_model` in configuration) and `gpt-4` for more complex
review and commenting tasks (`openai_heavy_model` in configuration).

Costs: `gpt-3.5-turbo` is dirt cheap. `gpt-4` is orders of magnitude more
expensive, but the results are vastly superior. We are typically spending $20 a
day for a 20 developer team with `gpt-4` based review and commenting.

### Prompts & Configuration

Expand Down Expand Up @@ -206,18 +190,7 @@ Build the typescript and package it for distribution
$ npm run build && npm run package
```

### Inspect the messages between OpenAI server
### Inspect the messages between Anthropic server

Set `debug: true` in the workflow file to enable debug mode, which will show the
messages

### Disclaimer

- Your code (files, diff, PR title/description) will be sent to OpenAI's servers
for processing. Please check with your compliance team before using this on
your private code repositories.
- OpenAI's API is used instead of ChatGPT session on their portal. OpenAI API
has a
[more conservative data usage policy](https://openai.com/policies/api-data-usage-policies)
compared to their ChatGPT offering.
- This action is not affiliated with OpenAI.
73 changes: 33 additions & 40 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'AI-based PR Reviewer & Summarizer with Chat Capabilities'
branding:
icon: 'git-merge'
color: 'orange'
author: 'CodeRabbit LLC'
author: 'gwilkes-rv'
inputs:
debug:
required: false
Expand Down Expand Up @@ -148,77 +148,66 @@ inputs:
required: false
description: 'Disable release notes'
default: 'false'
openai_base_url:
required: false
description: 'The url of the openai api interface.'
default: 'https://api.openai.com/v1'
openai_light_model:
anthropic_light_model:
required: false
description:
'Model to use for simple tasks like summarizing diff on a file.'
default: 'gpt-4o-mini'
openai_heavy_model:
default: 'claude-3-haiku-20240307'
anthropic_heavy_model:
required: false
description: 'Model to use for complex tasks such as code reviews.'
default: 'gpt-4o'
openai_model_temperature:
default: 'claude-3-5-sonnet-20240620'
anthropic_model_temperature:
required: false
description: 'Temperature for GPT model'
default: '0.05'
openai_retries:
anthropic_retries:
required: false
description:
'How many times to retry OpenAI API in case of timeouts or errors?'
'How many times to retry Anthropic API in case of timeouts or errors?'
default: '5'
openai_timeout_ms:
anthropic_timeout_ms:
required: false
description: 'Timeout for OpenAI API call in millis'
description: 'Timeout for Anthropic API call in millis'
default: '360000'
openai_concurrency_limit:
anthropic_concurrency_limit:
required: false
description: 'How many concurrent API calls to make to OpenAI servers?'
description: 'How many concurrent API calls to make to Anthropic servers?'
default: '6'
github_concurrency_limit:
required: false
description: 'How many concurrent API calls to make to GitHub?'
default: '6'
system_message:
required: false
description: 'System message to be sent to OpenAI'
description: 'System message to be sent to Anthropic'
default: |
You are `@redrover` (aka `github-actions[bot]`), a language model
trained by OpenAI. Your purpose is to act as a highly experienced
software engineer and provide a thorough review of the code hunks
and suggest code snippets to improve key areas such as:
- Logic
- Security
- Performance
- Data races
- Consistency
- Error handling
- Maintainability
- Modularity
- Complexity
- Optimization
- Best practices: DRY, SOLID, KISS
You are `@redrover` (aka `github-actions[bot]`), a language model
trained by Anthropic. Your purpose is to act as a highly experienced
software engineer and provide a thorough review of the code, related documents, and articles
and suggest code snippets to improve these with various aspects.
Do not comment on minor code style issues, missing
comments/documentation. Identify and resolve significant
concerns to improve overall code quality while deliberately
disregarding minor issues.
Follow the following instructions.
summarize:
required: false
description: 'The prompt for final summarization response'
default: |
Provide your final response in markdown with the following content:
**Walkthrough**: A high-level summary of the overall change instead of
specific files within 80 words.
**Changes**: A markdown table of files and their summaries. Group files
with similar changes together into a single row to save space.
- **Walkthrough**: A high-level summary of the overall change instead of
specific files within 80 words.
- **Changes**: A markdown table of files and their summaries. Group files
with similar changes together into a single row to save space.
Avoid additional commentary as this summary will be added as a comment on the
GitHub pull request. Use the titles "Walkthrough" and "Changes" and they must be H2.
review_file_diff:
required: false
description: 'The additional instruction for reviewing file diff'
default: |
- Do NOT provide general feedback, summaries, explanations of changes, or praises for making good additions.
- Focus solely on offering specific, objective insights based on the given context and refrain from making broad comments about potential impacts on the system or question intentions behind the changes.
summarize_release_notes:
required: false
description:
Expand Down Expand Up @@ -248,6 +237,10 @@ inputs:
required: false
description: ISO code for the response language
default: en-US
bot_icon:
required: false
description: 'The icon for Red Rover'
default: 🐶
runs:
using: 'node20'
main: 'dist/index.js'
2 changes: 1 addition & 1 deletion dist/37.index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 129 additions & 0 deletions dist/73.index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d883838

Please sign in to comment.