Welcome to today's blog post, where we'll be exploring the exciting possibilities of using the ChatGPT API in combination with Qt and QML to create chatbots and AI assistants. OpenAI recently released the ChatGPT API, which is a large language model that provides a chat interface that can be used to create custom applications, chatbots, and more.
This post is a summary of the more in detailed video blog post which can be found here:
To use the ChatGPT API, you'll need to download an access token and set up a paid account. Once you have the access token, you can start using the OpenAI APIs to create your chatbot or AI assistant. In this post, we'll be discussing a ChatGPT client called Intellicute, which is based on Qt and QML. The client uses the ChatGPT API and the Whisper API for speech to text, and it also uses a third-party API for text to speech to provide a better user experience. You can find the code on GitHub: Intellicute on GitHub
The Intellicute client provides a chat interface where you can add and remove messages and create requests. You can enter text to create a request, or you can use the speech to text feature to talk to the chatbot. The client also has a talking feature that uses text to speech to respond to your requests. The client is implemented in Qt and QML, and it uses live coding to reload the QML code whenever changes are made to the source code.
One interesting thing that the ChatGPT API can do is generate Markdown, which is useful for creating presentations or writing documentation. The formatting in Intellicute is already done for you, and you can even disable Markdown rendering if you want to. However, it's important to be aware that ChatGPT can sometimes interpolate information and create alternative facts, especially on controversial topics. It's not always reliable for fact-checking, but it's great for first-rate research, code generation, and test code generation.
If you need some inspiration for creating ChatGPT prompts, you can check out the awesome ChatGPT prompts project on GitHub. There are many templates available for all sorts of applications, from acting as a mathematician to generating passwords. You can even use it to create a code generator for a domain-specific language.
In addition to ChatGPT, I also explored GitHub Copilot, which uses a large language model to give you code completions. While it's not compatible with Qt Creator, it can be used with VS code and other code editors. The quality of the generated code is mixed for Qt/C++ and QML. However, it works very well if you work on existing files, as it interpolates the code very well, especially in QML UI code.
In conclusion, the ChatGPT API and large language models are powerful tools that can be used in many different ways. With some prompt engineering, they can be a very useful tool for developers. However, it's important to be aware of their limitations and to use them responsibly. We hope this post has given you some ideas for how to use ChatGPT and Qt to create your own chatbots and AI assistants.