Skip to main content

Python Wrapper for the ChatGPT API

Project description

pygptwrapper - A Python Wrapper for the ChatGPT API

pygptwrapper is a Python library that provides a simple way to interact with the ChatGPT API, which is a powerful language model trained by OpenAI that can generate human-like text based on input prompts.

This library makes it easy to integrate the ChatGPT API into your Python applications, allowing you to generate text in real-time, create chatbots, or automate text generation tasks. It provides context-based model using newly introduced model gpt-3.5-turbo.

Installation

To install pygptwrapper, you can use pip:

pip install pygptwrapper

Usage

Here's a basic example of how to use pygptwrapper:

from pygptwrapper import ContextualGPT

# Instantiate the ContextualGPT object with a ```task``` and ```api_key```
gpt = ContextualGPT(
    task="You are a chatbo assistant. You will give recommendations for restaurants."
    api_key=api_key
)

Initiate a conversation with instanciated bot

text = gpt.ask(question="What is the meaning of life?") print(text) This will generate a response from the ChatGPT API based on the input prompt. Notice that contextual conversation is stored in gpt.conversation.

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

pygptwrapper-0.2.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

pygptwrapper-0.2.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file pygptwrapper-0.2.0.tar.gz.

File metadata

  • Download URL: pygptwrapper-0.2.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.8.5 Darwin/21.5.0

File hashes

Hashes for pygptwrapper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 984bdda51560b0e14177a2a346a2b1a501f01d572fbc3eb58fb38451c4e95869
MD5 0bc81d23c67ed4f245711296c7bffa65
BLAKE2b-256 b43f3df2b8d6a103b40bd31b795ecb3f0c5bb293d3f3239bd164156ce164bbf4

See more details on using hashes here.

File details

Details for the file pygptwrapper-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pygptwrapper-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.8.5 Darwin/21.5.0

File hashes

Hashes for pygptwrapper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8adab784823fc7f601d15e4eec270e10238666e3c38dae43fd5f9b5fbd9327a8
MD5 f85cbc651656df8c9cfc49763b73f51d
BLAKE2b-256 ad50c75b15dfc8c6e16fbd17d7f4ea2edefa2c1ee0ab933d34221c916f1f16d2

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