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
Metadata
Release files for gpt-assistant-lib 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gpt_assistant_lib-0.3.1.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gpt_assistant_lib-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.7 kB
Release files / gpt_assistant_lib-0.3.1.tar.gz
| Download URL | gpt_assistant_lib-0.3.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9760db7943d6178c845907de677c8a86b46fe6e2e4ac6f70dbeb046c626b743f
|
|
BLAKE2b-256 checksum How to use checksums |
e2bb67bb7d60446e2e3396fd4ac011aae54c9646788930dc30ee05c255746c78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.3 Darwin/22.6.0
|
Release files / gpt_assistant_lib-0.3.1-py3-none-any.whl
| Download URL | gpt_assistant_lib-0.3.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39058ce0d8246d55a93fdf0f7d999c7823ee04d7c3b14fc227a7613cb0be1a50
|
|
BLAKE2b-256 checksum How to use checksums |
1b47b6e984af5e5dfde183c31288538fd3e555af278116cf3c822b6039128190
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.3 Darwin/22.6.0
|