Skip to content

Commit

Permalink
add openai chat support and GitHub actions (#2)
Browse files Browse the repository at this point in the history
* Add support for ChatCompletion

* Add github workflows

* Update versions and add lock file
  • Loading branch information
smatzkel-newrelic committed Mar 5, 2023
1 parent 5de4837 commit 653159d
Show file tree
Hide file tree
Showing 6 changed files with 388 additions and 6 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

name: Publish to PyPI

on:
release:
types:
- published

permissions:
contents: read

jobs:
build-and-publish-test-pypi:
name: PyPI - Build and publish Python 🐍 distributions 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Poetry Setup
uses: snok/install-poetry@v1
with:
version: 1.4.0
- name: Build and publish to test pypi
run: |
poetry version ${{ github.event.release.tag_name }}
poetry build
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish
30 changes: 30 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

name: Publish to Test PyPI

on:
push:
branches:
- main

permissions:
contents: read

jobs:
build-and-publish-test-pypi:
name: Test PyPI - Build and publish Python 🐍 distributions 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Poetry Setup
uses: snok/install-poetry@v1
with:
version: 1.4.0
- name: Build and publish to test pypi
run: |
poetry version ${{ github.event.release.tag_name }}
poetry build
poetry config repositories.test-pypi "https://test.pypi.org/legacy/"
poetry config pypi-token.test-pypi ${{ secrets.TEST_PYPI_TOKEN }}
poetry publish --repository test-pypi
42 changes: 42 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
poetry-version: [ 1.4.0 ]

steps:
- uses: actions/checkout@v3
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
261 changes: 261 additions & 0 deletions poetry.lock

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

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ description = ""
authors = ["AIR <applied-intelligence-research-team@newrelic.com>"]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.7.1"
newrelic-telemetry-sdk = "^0.4.3"
openai = "^0.26.0"
openai = "^0.8"

[tool.poetry.dev-dependencies]
pytest = "^7.2.1"


[build-system]
requires = ["poetry-core>=1.0.0"]
requires = ["poetry-core>=1.1.0"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit 653159d

Please sign in to comment.