Skip to content

Commit

Permalink
feat/ci: Add deployment workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
drudilorenzo committed Apr 8, 2024
1 parent c94fd91 commit 7ad58d6
Show file tree
Hide file tree
Showing 12 changed files with 277 additions and 98 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: read

jobs:
release-on-push:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- id: release
uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: minor

- uses: actions/checkout@v2
with:
ref: ${{ steps.release.outputs.tag_name }}

- name: deploy
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
VERSION_NUMBER: ${{ steps.release.outputs.tag_name }}
run: |
echo "Deploying ${{ steps.release.outputs.tag_name }} to PyPI"
pip install twine
python setup.py sdist
twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@ azure_openai_key.txt
openai_api_key.txt
openai_organization.txt

# PyPi API token
pypi_api_token.txt

# Cost log files
cost-logs/
cost-logs/

# PyTest
.pytest_cache
*.egg-info/

build/
dist/
19 changes: 0 additions & 19 deletions README.md

This file was deleted.

35 changes: 35 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. image:: https://img.shields.io/badge/chatGPT-74aa9c.svg?logo=openai
.. image:: https://img.shields.io/pypi/pyversions/setuptools.svg

==================
OpenAI Cost Logger
==================

Simple cost logger for OpenAI requests.
Track the cost of every request you make to OpenAI and visualize them in a user-friendly way.

How to install:
---------------
* .. code-block:: python

pip install openai-cost-logger

* .. code-block:: python

from openai_cost_logger.constants import DEFAULT_LOG_PATH, Models, MODELS_COST
from openai_cost_logger.openai_cost_logger_viz import OpenAICostLoggerViz
from openai_cost_logger.openai_cost_logger_utils import OpenAICostLoggerUtils
from openai_cost_logger.openai_cost_logger import OpenAICostLogger

* See also the homepage on `PyPI <https://pypi.org/project/openai-cost-logger/>`_.
* See the `demo file <https://github.com/drudilorenzo/track-openai-cost/blob/master/demo.ipynb>`_ for a usage example.

Key Features:
-------------
* Track the cost of every request you make to OpenAI and save them in a csv file.
* Visualize the cost of all the requests you have made.

Endpoint supported:
-------------------
* Chat completion.
* Every endpoint which response contains the field "*usage.prompt_tokens*" and "*usage.completion_tokens*".
Loading

0 comments on commit 7ad58d6

Please sign in to comment.