Skip to main content

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


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)

Uploaded Source

Built Distribution

openaiapi-0.0.2-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page