Skip to content

Commit

Permalink
migrated to new openai 1.0.0 API
Browse files Browse the repository at this point in the history
  • Loading branch information
phelps-sg committed Nov 17, 2023
1 parent d27af22 commit 9861508
Show file tree
Hide file tree
Showing 6 changed files with 394 additions and 198 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ repos:

# mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.2.0' # Use the sha / tag you want to point at
rev: 'v1.7.0' # Use the sha / tag you want to point at
hooks:
- id: mypy
exclude: 'jupyter-book/.*|tests/.*'
args: [--config=mypy.ini, --explicit-package-bases]
additional_dependencies: [ pandas-stubs ]
additional_dependencies: [ openai ]

# mypy for tests
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.2.0' # Use the sha / tag you want to point at
rev: 'v1.7.0' # Use the sha / tag you want to point at
hooks:
- id: mypy
name: mypy-tests
files: ^tests/
args: [--config=mypy-tests.ini]
additional_dependencies: [ pandas-stubs ]
additional_dependencies: [ openai ]

# pylint
- repo: local
Expand All @@ -91,4 +91,4 @@ repos:
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=.pylintrc",
]
]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/phelps-sg/openai-pygenerator)
![GitHub](https://img.shields.io/github/license/phelps-sg/openai-pygenerator?color=blue)

## Import Note

The openai Python API versions 1.0.0 and later now incorporate retry functionality and type annotations. This package has been migrated to the new API, but should only be used as a temporary measure to ensure backward compatibility. If you are using this package in production, consider rewriting your code so that it uses the new openai API directly.

## Overview

This is a simple type-annotated wrapper around the OpenAI Python API which:
- provides configurable retry functionality,
- reduces the default timeout from 10 minutes to 20 seconds (configurable),
Expand Down
Loading

0 comments on commit 9861508

Please sign in to comment.