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.1.tar.gz
(3.4 kB
view details)
Built Distribution
File details
Details for the file openaiapi-0.0.1.tar.gz
.
File metadata
- Download URL: openaiapi-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5027298a1c5080a24cceccbeb2133772b1faf53c6245b55ea0d9a1f8fdf87c02 |
|
MD5 | 607e407c4cbdb260132b69b2a74e16e7 |
|
BLAKE2b-256 | 7e3f9a7713b0451a0463f70d3b24ec0aaecd0fb056e5880e7ad26c19cf0f769a |
File details
Details for the file openaiapi-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: openaiapi-0.0.1-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.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91c7f1d04da90477316ad7ae7e791db486ba1f7a38f4882db449219641a42b1f |
|
MD5 | 7731ec42ee85431a028b86f310f8cf32 |
|
BLAKE2b-256 | bf9800b0b092610617f34778d4040920aaa8f39d34fe3747becb8db3195873d3 |