Doc: Add docs for ai-assistant plugin

Change-Id: I7c1d50bcadc083b9ff20bbc295781fddf6de1ddb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Leena Miettinen
2024-09-02 14:57:51 +02:00
parent 5eb5e54b23
commit 697f2ff004

View File

@@ -12,11 +12,100 @@ return {
Experimental = true, Experimental = true,
DisabledByDefault = true, DisabledByDefault = true,
LongDescription = [[ LongDescription = [[
The Qt AI Assistant extension is your personal coding assistant. The Qt AI Assistant can provide code suggestions triggered by a keyboard shortcut (CTRL-SHIFT-A), on request in an inline chat window, or automatically while you are typing. You can configure the Qt AI Assistant to collect suggestions from different commercial or open-source Large Language Models (LLM). Qt AI Assistant is a coding assistant. When connected to a Large Language
Model (LLM), it auto-completes your code, as well as writes test cases and
code documentation.
You also need one of the following valid Qt licenses: Qt for Application Development Enterprise, Qt for Device Creation Professional, Qt for Device Creation Enterprise, Qt for Small Business, Qt Evaluation License, Qt Education License. Qt AI Assistant is available for selected commercial Qt developer
license holders. For more information on licensing, select `Compare`
in [Qt pricing](https://www.qt.io/pricing).
You will need access to a LLM for the suggestions. You can use a subscription to a commercial, cloud-hosted LLM, a privately hosted or on-premise LLM, or a Small Language Model running locally on your computer. > **Note:** Qt AI Assistant is LLM-agnostic. The subscription to a third-party
LLM service or a third-party LLM for local or cloud deployment is not a part
of it. You need to connect to a third-party LLM and agree to the terms and
conditions, as well as to the acceptable use policy of the LLM provider. By
using Qt AI Assistant, you agree to
[Terms & Conditions - Qt Development Framework](https://www.qt.io/terms-conditions/qt-dev-framework).
Qt AI Assistant is currently experimental and powered by generative AI. Check
all suggestions to make sure that they are fit for use in your project.
> **Note:** [Install and load](https://doc.qt.io/qtcreator/creator-how-to-load-extensions.html)
the Qt AI Assistant extension to use it.
## Connect to a LLM
You can connect to the following LLMs:
- Meta Llama 3.1 70B (running in a cloud deployment of your choice
- Anthropic Claude 3.5 Sonnet (provided as subscription-based service by Anthropic)
To connect to a LLM:
1. Go to `Preferences` > `AI Assistant`
1. Select the use cases and programming languages to use the LLM for
1. Enter the authentication token, user name, and API URL of the LLM.
For more information on where to get the access information, see the
third-party LLM provider documentation.
## Automatic code-completio
Qt AI Assistant can help you write code by suggesting what to write next.
It prompts the LLM to make one or several code suggestions based on the
current cursor position and the code before and after the cursor when you
stop typing. The code suggestions are shown after the cursor in grey color.
To accept the entire suggestion, press the `Tab` key.
To accept parts of the suggestions, press `Alt+Right`.
To dismiss the suggestion, press `Esc` or navigate to another position in
the code editor.
To interact with Qt AI Assistant using the mouse, hover over the suggestion.
When you hover over a suggestion, you can accept parts of the suggested code
snippet word-by-word. Or, cycle through alternative suggestions in the code
completion bar by selecting the `<` and `>` buttons.
To close the code completion bar, press `Esc` key or move the cursor to
another position.
To turn auto-completion of code on or off globally for all projects, go to
`Preferences` > `AI Assistant`. Qt AI Assistant consumes a significant number
of tokens from the LLM. To cut costs, disable the auto-completion feature when
not needed, and use keyboard shortcuts for code completion.
## Complete code from the keyboard
To trigger code suggestions manually, press `Ctrl+Shift+A` (`Cmd+Shift+A` on macOS).
## Chat with the assistant
In an inline chat window in the code editor, you can prompt the assistant to
implement your requests in human language, ask questions, or execute
*smart commands*. To open the chat, press `Ctrl+Shift+D` (`Cmd+Shift+D` on macOS).
To close the chat, press `Esc` or select the `Close` button.
To go to Qt AI Assistant preferences from the chat, select the `Settings` button.
### Request suggestions using human language
To request suggestions using human language, type your requests in the chat.
Qt AI Assistant shows a suggestion that you can copy to the clipboard by
selecting the `Copy` button in the chat.
### Request test cases in Qt Test syntax
To write test cases with Qt AI Assistant:
- Highlight code in the code editor
- Press `Ctrl+Shift+D` (`Cmd+Shift+D` on macOS) to open the chat
- Select the `qtest` smart command.
Qt AI Assistant generates a test case in [Qt Test](https://doc.qt.io/qt-6/qttest-index.html)
format that you can copy and paste to your
[Qt test project](https://doc.qt.io/qtcreator/creator-how-to-create-qt-tests.html.
]], ]],
Dependencies = { Dependencies = {
{ Id = "lua", Version = "14.0.0" }, { Id = "lua", Version = "14.0.0" },