A light wrapper around the OpenAI API using apiron
Project description
openaiapi
A light wrapper around the OpenAI API using apiron.
Installation
$ python -m pip install openaiapi
Usage
First, make an OPENAI_API_KEY
environment variable available whose value is your OpenAI API key. Once you have an API in place, you can use the OpenAI
class to generate content:
>>> from openaiapi import OpenAI
>>> OpenAI.completions(json={"model": "text-davinci-003", "prompt": "What is your quest?"})
{..., 'choices': [{'text': '\n\nMy quest is to find my purpose and fulfill it.', ...}], ...}}
See the package documentation for the full list of available endpoints, and see the OpenAI documentation for the accepted/required parameters to each endpoint.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openaiapi-0.0.2.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file openaiapi-0.0.2.tar.gz
.
File metadata
- Download URL: openaiapi-0.0.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b38cc039eb9e19c1662c6d4de702f567aed0848332941016921988f97c3ec29 |
|
MD5 | cb5d3c7f593a7e46a9a6b25991265371 |
|
BLAKE2b-256 | f1986beeefa21beee5c314023242a68d8902947a1461f38cc21fa18d7d31757c |
File details
Details for the file openaiapi-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: openaiapi-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6c206b8dba4e1ae109c21a3810933416fbdafd19349cd3b9302dd74ed9676b8 |
|
MD5 | ae640db81857df9a1a961ad9619c4f3b |
|
BLAKE2b-256 | 928e85a7e40fc9488315d6442f9646634d2336af62dd25888fe2830c75d7fc3c |