Skip to main content

Python library for your AI assistant, powered by GPT.

Project description

GPT-Assistant Library

The GPT-Assistant Library is a Python-based toolkit for building intelligent personal assistants powered by OpenAI's GPT models. This library simplifies the integration of conversational AI into your applications, making it easier than ever to create chatbots, virtual assistants, and more.

Key Features

  • Seamless integration with GPT-3 and GPT-4 models.
  • Easily manage conversations and user interactions.
  • Support multiuser chat history support
  • Customizable and extensible to suit your specific needs.
  • Developer-friendly API for smooth integration into your projects.

Installation

pip install gpt-assistant-lib

Configuration

To set up the assistant, you need an API key and to create a system prompt.

Obtain API key

Go to Openai website

System prompt

It will define your assistant behaviour. More info you can find in documentation

History

The library maintains a conversation history that the assistant relies on to understand and maintain context during interactions. This conversation history is included in every request sent to OpenAI. A larger history size allows the assistant to remember more context, enhancing its ability to engage in meaningful conversations. However, it's important to note that larger conversation histories can result in increased API call costs.

Usage

import gpt_assistant_lib

openai_api_key = "your_openai_api_key"
initial_prompt = "You are a helpful assistant."
max_history_size = 5
history_lifetime = 600  # 10 minutes
assistant = gpt_assistant_lib.build_assistant(openai_api_key, initial_prompt, max_history_size, history_lifetime)
while True:
    user_input = input("You: ")
    assistant_response = assistant.exchange("any", user_input)
    print(f"Assistant: {assistant_response}")

Development

Run with enabled virtual environment

Autoformat source code

task format

Run all linters

task lint

Run unit tests

task test

Run all linters and unit tests

task all

License

This project is licensed under the MIT License

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

gpt_assistant_lib-0.3.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

gpt_assistant_lib-0.3.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file gpt_assistant_lib-0.3.1.tar.gz.

File metadata

  • Download URL: gpt_assistant_lib-0.3.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/22.6.0

File hashes

Hashes for gpt_assistant_lib-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9760db7943d6178c845907de677c8a86b46fe6e2e4ac6f70dbeb046c626b743f
MD5 616e27edbdf95185f695bcc4c7ffe37b
BLAKE2b-256 e2bb67bb7d60446e2e3396fd4ac011aae54c9646788930dc30ee05c255746c78

See more details on using hashes here.

File details

Details for the file gpt_assistant_lib-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gpt_assistant_lib-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39058ce0d8246d55a93fdf0f7d999c7823ee04d7c3b14fc227a7613cb0be1a50
MD5 b35b7c2a720b1dbb3c0cf65875ecfe11
BLAKE2b-256 1b47b6e984af5e5dfde183c31288538fd3e555af278116cf3c822b6039128190

See more details on using hashes here.

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