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 hashes)
Built Distribution
Close
Hashes for openaiapi-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6c206b8dba4e1ae109c21a3810933416fbdafd19349cd3b9302dd74ed9676b8 |
|
MD5 | ae640db81857df9a1a961ad9619c4f3b |
|
BLAKE2b-256 | 928e85a7e40fc9488315d6442f9646634d2336af62dd25888fe2830c75d7fc3c |