Skip to content

Commit

Permalink
Merge pull request #7 from feiskyer/oai
Browse files Browse the repository at this point in the history
Add support for Azure OpenAI Service
  • Loading branch information
feiskyer authored Mar 27, 2023
2 parents 178b80f + 68172a0 commit fe6baf3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }}
# Optional configurations:
# with:
# model: "gpt-3.5-turbo"
Expand All @@ -38,6 +39,7 @@ jobs:
|---------|-----------|--------|-------|
|GITHUB_TOKEN|Github token used to send out review comments|true|""|
|OPENAI_API_KEY|API key used to invoke OpenAI|true|""|
|OPENAI_API_BASE|API based used to access Azure OpenAI|false|""|
|blocking|Blocking the pull requests on OpenAI failures|false|False|
|model|OpenAI model name|false|gpt-3.5-turbo|
|temperature|Temperature for the model|false|0.2|
Expand Down
3 changes: 3 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
OPENAI_API_KEY:
description: "API key used to invoke OpenAI"
required: true
OPENAI_API_BASE:
description: "API based used to access [Azure] OpenAI API"
required: false
model:
description: "OpenAI model name"
default: "gpt-3.5-turbo"
Expand Down
22 changes: 15 additions & 7 deletions app/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
import tiktoken

openai.api_key = os.getenv("OPENAI_API_KEY")
system_prompt = '''As a tech reviewer, please provide an in-depth review of the following pull request and pay close attention to the following:
* Review the title, body, and changes made in the pull request.
* Identify any problems and provide clear descriptions and suggestions for how to address them.
* Offer constructive suggestions for optimizing the changes made in the pull request.
* Avoid providing unnecessary explanations or summaries that may delay the review process.
* Provide feedback in a concise and clear manner to help expedite the review process.
* No need for thanking in the review message.
if os.getenv("OPENAI_API_BASE"):
openai.api_base = os.getenv("OPENAI_API_BASE")
if "azure" in os.getenv("OPENAI_API_BASE"):
openai.api_type = "azure"
openai.api_version = "2023-03-15-preview"
system_prompt = '''As a tech reviewer, please provide an in-depth review of the
following pull request. Your task is to carefully analyze the title, body, and
changes made in the pull request and identify any problems that need addressing.
Please provide clear descriptions of each problem and offer constructive suggestions
for how to address them. Additionally, please consider ways to optimize the changes
made in the pull request. You should focus on providing feedback that will help
improve the quality of the codebase while also remaining concise and clear in your
explanations. Please note that unnecessary explanations or summaries should be avoided
as they may delay the review process. Your feedback should be provided in a timely
manner, using language that is easy to understand and follow.
'''


Expand Down

0 comments on commit fe6baf3

Please sign in to comment.