Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

[TEST] - PR z038 #38

Closed
wants to merge 15 commits into from
16 changes: 8 additions & 8 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
cmd: pycodestyle --show-source --show-pep8 --exclude=src/tests
python-version: 3.11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pip
Expand All @@ -43,10 +43,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -r requirements.txt
Expand All @@ -55,10 +55,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -r requirements.txt
Expand Down
3 changes: 1 addition & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
model:
description: 'OpenAI model in use'
required: false
default: "text-davinci-003"
default: "gpt-3.5-turbo"
template:
description: 'PR content template for OpenAI to understand what must be in the pull request description'
required: false
Expand Down Expand Up @@ -48,4 +48,3 @@ runs:
INPUT_MODEL: ${{ inputs.model }}
OPENAI_API_KEY: ${{ inputs.api-key }}
GITHUB_BRANCH: ${{ github.head_ref }}
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions dev/01.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INPUT_MODEL="text-davinci-003"
INPUT_TEMPLATE=""
INPUT_TEMPLATE_FILEPATH=".github/PULL_REQUEST_TEMPLATE.md"
INPUT_HEADER="Based on the output of the command \`git diff\`, could you please generate a pull request description using the provided information? Be concise. Description must follow this format:\n"
GITHUB_ACTION_PATH=""
5 changes: 5 additions & 0 deletions dev/02.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INPUT_MODEL="text-davinci-003"
INPUT_TEMPLATE="# Description\n## What is in this PR ?"
INPUT_TEMPLATE_FILEPATH=""
INPUT_HEADER="Based on the output of the command \`git diff\`, could you please generate a pull request description using the provided information? Be concise. Description must follow this format:\n"
GITHUB_ACTION_PATH=""
4 changes: 3 additions & 1 deletion dev/dev.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/sh
set -o errexit
# shellcheck source=dev/env-01.sh
set -o allexport
# shellcheck source=dev/01.env
. "$1"
set +o allexport

FILE='short_commit_sha'
CONTENT="$(git rev-parse --short HEAD)"
Expand Down
5 changes: 0 additions & 5 deletions dev/env-01.sh

This file was deleted.

5 changes: 0 additions & 5 deletions dev/env-02.sh

This file was deleted.

44 changes: 22 additions & 22 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
aiohttp==3.9.4
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
certifi==2024.7.4
cffi==1.15.1
charset-normalizer==3.1.0
cryptography==42.0.4
Deprecated==1.2.13
frozenlist==1.3.3
idna==3.7
multidict==6.0.4
openai==0.27.6
pycparser==2.21
PyGithub==1.58.2
PyJWT==2.7.0
Deprecated==1.2.14
PyGithub==2.4.0
PyJWT==2.9.0
PyNaCl==1.5.0
PyYAML==6.0
requests==2.32.2
tqdm==4.66.3
urllib3==2.2.2
wrapt==1.15.0
yarl==1.9.2
PyYAML==6.0.2
aiohttp==3.10.8
aiosignal==1.3.1
async-timeout==4.0.3
attrs==24.2.0
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.3.2
cryptography==43.0.1
frozenlist==1.4.1
idna==3.10
multidict==6.1.0
openai==1.50.2
pycparser==2.22
requests==2.32.3
tqdm==4.66.5
urllib3==2.2.3
wrapt==1.16.0
yarl==1.13.1
1 change: 1 addition & 0 deletions short_commit_sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b70a03d
6 changes: 4 additions & 2 deletions src/opnai/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ def generate_description(self, text):
"""
data = self.__header + self.__template + "\n\n" + text
openai.api_key = self.__key
response = openai.Completion.create(
client = openai.OpenAI()
response = client.chat.completions.create(
model=self.__model,
prompt=data,
{"role": "system", "content": "You are a helpful assistant."}, # Rework to do here
messages=[{"role": "user", "content": data}],
temperature=0.9,
max_tokens=150,
top_p=1,
Expand Down
Loading