PyQt/PySide multipurpose chatbot that user can use GPT, other AI models altogether
Project description
pyqt-openai
Multi-purpose Text & Image Generation Desktop Commercial Chatbot (supporting various models including GPT)
This application is developed using PyQt.
It supports Windows, macOS, and Linux.
It uses SQLite as a database.
You can use OpenAI models (GPT-4, GPT-4 Mini, DALL-E, etc.) and Replicate image generation models with PyQt.
The major advantage of this package is that you don't need to know any language aside from Python.
If you want to study OpenAI with Python-only in a good old desktop software environment, this is for you.
You can select the model and adjust each parameter of OpenAI from the right sidebar.
Additionally, you can combine OpenAI with the Llama-Index feature to make the GPT model answer your questions based on the information you have provided!
If you have any questions or if you want to develop AI-related software with PyQt or PySide, feel free to join the Discord server!
If you would like to support this project, please click the button below to make a donation. Your contribution will greatly assist various projects, including this one!
Table of Contents
- Feature
- Supported Languages
- Requirements
- Preview and Usage
- How to Install
- Troubleshooting
- Contact
- Note
- Disclaimer
Feature
- Basically this is desktop application version of ChatGPT with image generation tool.
- Conversation(=Thread) management
- Add & delete conversations
- Export & Import conversations (including import from ChatGPT)
- "Favorite" feature
- Support JSON mode
- Everything above is saved in an SQLite database file named conv.db. (File's name can be changed by yourself)
- Support text(.txt), image(.png, *.jpg) file uploading
- Support controlling parameters(temperature, top_p, etc)
- You can see the reason why stream is finished.
- Support token count (only for non-streaming response)
- Support prompt generator (manageable, autosaved in database)
- Support import & export prompt group as JSON
- Full screen feature
- Support slash commands
- Support beginning and ending part of the prompt
- You can run this in background
- Notification will pop up when response is generated
- You can make window stack on top or control its transparency
- Image generation (DALL-E3 from openai, a bunch of image models in Replicate)
- Support saving generated image to local
- Support continue generation
- Notification when task completes
- Support llamaindex
- Support customizing feature (homepage, user and AI profile image, font settings)
- Support light/dark theme based on your system settings (Above Qt6 only)
Supported Languages
- English
- Spanish
- Chinese
- Russian
- Korean
- French
- German
- Italian
- Hindi
- Arabic
- Japanese
- Bengali
- Urdu
- Indonesian
- Portuguese
If you have any additional languages you would like to add, please feel free to make a request by mail, issue, discord, etc at any time.
Also you can submit a pull request if you want to update any words naturally by modify "translations.json" in "lang" directory.
Requirements
- qtpy - the package allowing you to write code that works with both PyQt5, PyQt6, PySide6
- PyQt5 >= 5.14 or PyQt6 (or PySide6 if you want)
- openai
- aiohttp - for openai dependency
- pyperclip - to copy prompt text from prompt generator
- jinja2 - for saving the conversation with html file
- llama-index - to fine-tune gpt with llamaindex
- requests - for getting response from web
- langchain - for connecting llama-index with gpt
- pillow - for preventing ModuleNotFoundError from llama-index
- replicate - for supporting Replicate
- toml - For reading pyproject.toml below 3.11
You can install these requirements with only one line command "pip install -r requirements.txt". Just see "How to Install" section below.
Preview and Usage
Note: A lot of previews below are not from latest version. It is slightly different with current GUI. So if you want to really know what this looks like, see it by yourself :) But i will definitely change any image(s) which should be changed.
Overview
You have to write your openai api key inside the red box. see How to install
You can change screen between text chatbot and image generating tool screen.
Using LlamaIndex
If you want to use this with your personal chatbot based on data you've given, then you can check the llamaindex checkbox and go to the tab, select the directory which includes .txt files containing the data.
Conversation
Preview 1
I recorded this preview long time ago so GUI is different from the current version, but way of operating it is pretty much the same.
Preview 2 (using prompt feature)
https://github.com/yjg30737/pyqt-openai/assets/55078043/841a1505-f1cc-452e-99ab-0a9c661e6ead
Conversation Save Feature
You can save checked conversation units to SQlite db file or compressed file (zip) which contains each conversation as text/html file.
Prompt Generator
How to Generate
This application has two types of prompts. One is "Properties" and the other one is "Template". Properties are sets of attributes that are useful for forming the premises of a question. Templates are sentences that correspond to a single command. You can input a command to generate a sentence. This can be used as a question in itself.
Both types can be managed as groups. After cloning or installing, if you run the program immediately, you will be able to see the default group and the items included in the group, just like the screen.
For properties, there is a group named "Default" that provides a set of attributes referenced here.
For templates, there are the "awesome_chatGPT_prompt" and "alex_brogan" (example prompt for Alex Brogan) groups provided. Any custom template items created prior to version 0.1.6 will be moved to the Miscellaneous group.
With using these prompts you can pretty much get any response you want.
You can use the additional prompt feature by "prompt menu" right next to "prompt input" field.
Since v0.1.6, awesome-chatgpt-prompt is included as template group by default.
Prompt Generator Preview
Generating the prompt (Properties)
https://github.com/yjg30737/pyqt-openai/assets/55078043/e168c0e6-41b4-4ad5-95e6-3c42c9c23602
I recorded using the Windows recording feature. As a result, the "Add Dialog" that prompts for entering a group name does not appear in the preview. When you add a group, you will see the Add Dialog as expected.
Then, how to generate template type prompt? Click any item in the group, it will be shown in the preview.
You can copy that generated text with clicking "copy" button and include it to your prompt input.
If you add a property group or template group with items, you can use it as a command by typing its name to the prompt input.
Use prompt as a command
https://github.com/yjg30737/pyqt-openai/assets/55078043/df0d3923-1fbe-4dda-af6f-4e4d1e572553
In this preview, i pressed the keyboard shortcut of each actions(show beginning, show ending, support prompt command) to use it rather than clicking them with mouse.
I made the command suggestion GUI resemble the Discord command autocomplete popup, with which a lot of people have become accustomed.
How to Install
- git clone ~
- cd pyqt-openai
- pip install -r requirements.txt --upgrade
- cd pyqt_openai
- You should put your api key in the line edit. You can get it in official site of openai. Sign up and log in before you get it.
- python main.py
Install with pyproject.toml
- git clone ~
- Run shell as Administrator
- cd pyqt-openai
- pip install .
- pyqt-openai
Note
If you use Linux and see this error:
qt.qpa.plugin: could not load the qt platform plugin "xcb" in "" even though it was found
this application failed to start because no qt platform plugin could be initialized, reinstalling the application may fix this problem
run this command:
sudo apt-get install libxcb-xinerama0
Troubleshooting
How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error
Please check that the path does not contain any other invalid languages.
qtpy.QtBindingsNotFoundError: No Qt bindings could be found
First, do this:
pip uninstall -r requirements.txt
second, do this:
pip install -r requirements.txt --upgrade
then it will work :)
Contact
You can join pyqt-openai's Discord Server to have a conversation about it or AI-related stuff 🙂
Disclaimer
Please do not distribute this commercially without my permission, by claiming it as your own creation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyqt_openai-0.8.2.tar.gz
.
File metadata
- Download URL: pyqt_openai-0.8.2.tar.gz
- Upload date:
- Size: 60.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f1e5a57fa7712ecbbe0e043fd79ac482ca142c5ee9a0b4d0ccea4589c3e59c |
|
MD5 | 6ebdb14b4a43aab91ea87434fbd61957 |
|
BLAKE2b-256 | c64d1f55e1dca691a427c6b7b3ae98deec644ae030773840800ec6863f288a89 |
File details
Details for the file pyqt_openai-0.8.2-py3-none-any.whl
.
File metadata
- Download URL: pyqt_openai-0.8.2-py3-none-any.whl
- Upload date:
- Size: 64.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cde42c8d90a951f7edf114a24b8aac2eeaf2e4b9cf95b864c60858e29692b8dc |
|
MD5 | 1daee54120a576cec6939afce3d9039c |
|
BLAKE2b-256 | be342888fe3d98b7f0bf3f9fd0c17410953d0c55c4e86299196a8bd48d97378c |