Skip to main content

GPT-3 wrapper for Python

Project description

gpt3_simple_primer

Wrapper used to simplify GPT-3 priming.

Background

Generative Pre-trained Transformer 3 (GPT-3) is an autoregressive language model that uses deep learning to produce human-like text. For more information, visit https://openai.com/blog/openai-api/.

Priming: the initial prompt fed to the language model for subsequent text generation

The OpenAI Python library is the official Python wrapper for the OpenAI API. The purpose of this library is to simplify the priming process by providing easy to use methods for setting the instructions and adding examples. For more flexibility around priming, please refer to the openai library.

Requirements

You will need an API key from OpenAI to access GPT-3.

Usage

from gpt3_simple_primer import GPT3Generator

key = 'sk-xxxxx'

generator = GPT3Generator(engine='davinci',
                          max_tokens=20,
                          temperature=0.5,
                          top_p=1)

generator.set_key(key)
generator.set_instructions('List the ingredients for this meal.')
generator.add_example('apple pie', 'apple, butter, flour, egg, cinnamon, crust, sugar')
generator.add_example('guacamole', 'avocado, tomato, onion, lime, salt')

# key lime, egg, sugar, butter, graham cracker, cream
generator.generate('key lime pie')

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

gpt3_simple_primer-0.0.25.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpt3_simple_primer-0.0.25-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file gpt3_simple_primer-0.0.25.tar.gz.

File metadata

  • Download URL: gpt3_simple_primer-0.0.25.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for gpt3_simple_primer-0.0.25.tar.gz
Algorithm Hash digest
SHA256 b603dcef2c05d5cb4f7ddc5537581246adadc29540bbe7af30909a1e31009be8
MD5 821ccfac3a7932ce9458629f0c87975c
BLAKE2b-256 1e2a0b4df5f2bc3c229cb5dc924e8c072bdf0c26532d4cf58d574399f566d5bb

See more details on using hashes here.

File details

Details for the file gpt3_simple_primer-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: gpt3_simple_primer-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for gpt3_simple_primer-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 ec586c68df12084dc7379168c46d8367600f46f332187a1fa0f4b80fd07b2d40
MD5 fba587576f4c37826c51983b43bebadb
BLAKE2b-256 007971b86256728e6a92f52dca986b74607570a81fb43a6024c3f3bb07871b91

See more details on using hashes here.

Supported by

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