An OpenAI QML plugin that could be used in Qt-based projects.
- Completions
- Chat Completions
- Edits
- Image Generations
- Image Edits
- Image Variations
- Embeddings
- Transcriptions
- Translations
- Moderations
Make sure you defined OPENAI_API_KEY environment. You could also do that active kit's run configuration on Qt Creator:
Projects -> Your kit -> Run -> Environment -> Details -> Add: OPENAI_API_KEY="your-key"
- Copy
qopenai
folder under your project's root directory - Add
qopenai
as a sub-directory in project's root CMakeLists.txt file after creating executable for your target(see qt_add_executable):
add_subdirectory(qopenai)
- Link required Qt modules and
qopenaiplugin
to the target:
target_link_libraries(appexample PRIVATE qopenaiplugin)
- Should you be interested in using this plugin as a library and instantiate them in C++, link it to the target with qopenai name instead of qopenaiplugin as below:
target_link_libraries(appexample PRIVATE qopenai)
- Then include directories for target to be able to
#include
and instantiate them in C++:
target_include_directories(qopenai PUBLIC ${CMAKE_SOURCE_DIR}/qopenai "${CMAKE_BINARY_DIR}/qopenai")
- Example app tested on Windows, OSX and iOS platforms with Qt's 6.5.0 kit.