- Supported editor extensions
- The context Chat is aware of
- Use GitLab Duo Chat in the GitLab UI
- Use GitLab Duo Chat in the Web IDE
- Use GitLab Duo Chat in VS Code
- Use GitLab Duo Chat in Visual Studio for Windows
- Use GitLab Duo Chat in JetBrains IDEs
- Watch a demo and get tips
- Configure Chat conversation expiration
- Give feedback
GitLab Duo Chat
{{< details >}}
- Tier: Premium, Ultimate
- Add-on: GitLab Duo Pro or Enterprise, GitLab Duo with Amazon Q
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
- LLMs: Anthropic Claude 3.7 Sonnet, Anthropic Claude 3.5 Sonnet V2, Anthropic Claude 3.5 Sonnet, Anthropic Claude 3.5 Haiku, and Vertex AI Search. The LLM depends on the question asked.
- LLM for Amazon Q: Amazon Q Developer
{{< /details >}}
{{< history >}}
- Introduced as an experiment for SaaS in GitLab 16.0.
- Changed to beta for SaaS in GitLab 16.6.
- Introduced as a beta for GitLab Self-Managed in GitLab 16.8.
- Changed from Ultimate to Premium tier in GitLab 16.9 while in beta.
- Generally available in GitLab 16.11.
- Changed to require GitLab Duo add-on in GitLab 17.6 and later.
{{< /history >}}
GitLab Duo Chat is an AI-native assistant that accelerates development with contextual, conversational AI. Chat:
- Explains code and suggests improvements directly in your development environment.
- Analyzes code, merge requests, issues, and other GitLab artifacts.
- Generates code, tests, and documentation based on your requirements and codebase.
- Integrates directly in the GitLab UI, Web IDE, VS Code, JetBrains IDEs, and Visual Studio.
- Can include information from your repositories and projects to deliver targeted improvements.
Before you start using Chat, decide which of the following methods you want to use to manage Chat:
- On GitLab.com or GitLab Self-Managed, the default GitLab AI vendor models and cloud-based AI gateway that is hosted by GitLab.
-
On GitLab Self-Managed, in GitLab 17.9 and later, GitLab Duo Self-Hosted with a supported self-hosted model. Self-hosted models maximize security and privacy by making sure nothing is sent to an external model.
{{< alert type=”note” >}}
You cannot use all Chat features with GitLab Duo Self-Hosted. For more information, see supported Chat features.
{{< /alert >}}
Supported editor extensions
You can use GitLab Duo Chat in:
- The GitLab UI
- The GitLab Web IDE (VS Code in the cloud)
- VS Code, with the GitLab Workflow extension for VS Code
- JetBrains IDEs, with the GitLab Duo Plugin for JetBrains
- Visual Studio for Windows, with the GitLab Extension for Visual Studio
{{< alert type=”note” >}}
If you have GitLab Self-Managed: GitLab Duo requires GitLab 17.2 and later for the best user experience and results. Earlier versions may continue to work, however the experience may be degraded.
{{< /alert >}}
The context Chat is aware of
GitLab Duo Chat is sometimes aware of the context you’re working in. Other times, you must be more specific with your request.
Duo Chat always has access to:
- GitLab documentation.
- General programming and coding knowledge.
In addition, Chat is aware of different information, depending on where you use it.
In the GitLab UI
Area | Available context | GitLab Duo Pro | GitLab Duo Enterprise | Instructions |
---|---|---|---|---|
Code files | File content | {{< icon name=”check-circle-filled” >}} Yes | {{< icon name=”check-circle-filled” >}} Yes | From the single file, ask about this code or this file .
|
Epics | Epic details | {{< icon name=”dash-circle” >}} No | {{< icon name=”check-circle-filled” >}} Yes | From the epic, ask about this epic , this , or the URL. From any UI area, ask about the URL.
|
Issues | Issue details | {{< icon name=”dash-circle” >}} No | {{< icon name=”check-circle-filled” >}} Yes | From the issue, ask about this issue , this , or the URL. From any UI area, ask about the URL.
|
Merge requests | MR details | {{< icon name=”dash-circle” >}} No | {{< icon name=”check-circle-filled” >}} Yes | From the merge request, ask about this merge request , this , or the URL. For more information, see Ask about a specific merge request.
|
Commits | Commit details | {{< icon name=”dash-circle” >}} No | {{< icon name=”check-circle-filled” >}} Yes | From the commit, ask about this commit or this . From any UI area, ask about the URL.
|
Pipeline jobs | Job details | {{< icon name=”dash-circle” >}} No | {{< icon name=”check-circle-filled” >}} Yes | From the pipeline job, ask about this pipeline job or this . From any UI area, ask about the URL.
|
In IDEs
Area | Available context | GitLab Duo Pro | GitLab Duo Enterprise | Instructions |
---|---|---|---|---|
Selected lines in editor | Selected code | {{< icon name=”check-circle-filled” >}} Yes | {{< icon name=”check-circle-filled” >}} Yes | With the lines selected, ask about this code or this file . Chat is not aware of the file; you must select the lines you want to ask about.
|
Epics | Epic details | {{< icon name=”dash-circle” >}} No | {{< icon name=”check-circle-filled” >}} Yes | Ask about the URL. |
Issues | Issue details | {{< icon name=”dash-circle” >}} No | {{< icon name=”check-circle-filled” >}} Yes | Ask about the URL. |
Files | File content | {{< icon name=”check-circle-filled” >}} Yes | {{< icon name=”check-circle-filled” >}} Yes | Use the /include command to search for project files to add to Duo Chat’s context. After you’ve added the files, you can ask Duo Chat questions about the file contents. Available for VS Code and JetBrains IDEs. For more information, see Ask about specific files.
|
In addition, in the IDEs, when you use any of the slash commands,
like /explain
, /refactor
, /fix
, or /tests,
Duo Chat has access to the
code you selected.
Additional features
Repository X-Ray automatically enriches
code generation requests for GitLab Duo Code Suggestions.
If your project has access to Code Suggestions, then the /refactor
, /fix
, and /tests
slash commands
also have access to the latest Repository X-Ray report, and include that report as context for Duo.
The extensions for GitLab Duo scan for secrets and sensitive values matching known formats. The extensions
redact this sensitive content locally before sending it to Duo Chat, or using it for code generation.
This applies to files added via /include
, and all generation commands.
Use GitLab Duo Chat in the GitLab UI
-
In the upper-right corner, select GitLab Duo Chat. A drawer opens on the right side of your screen.
The GitLab Duo Chat button is not visible in the following sections:
- Any of the Your work pages such as your To-Do List.
- Your user profile.
- Help.
- Enter your question in the chat text box and press Enter or select Send. It may take a few seconds for the interactive AI chat to produce an answer.
- Optional. Ask a follow-up question.
To ask a new question unrelated to the previous conversation, you might receive better answers
if you clear the context by typing /reset
or /clear
and selecting Send.
{{< alert type=”note” >}}
Only the last 25 messages are retained in the chat history.
{{< /alert >}}
Have multiple conversations with Chat
{{< details >}}
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
{{< /details >}}
{{< history >}}
-
Introduced in GitLab 17.10 with a flag named
duo_chat_multi_thread
. Disabled by default. - Enabled on GitLab Self-Managed in GitLab 17.11.
{{< /history >}}
{{< alert type=”flag” >}}
The availability of this feature is controlled by a feature flag. For more information, see the history.
{{< /alert >}}
In GitLab 17.10 and later, you can have multiple simultaneous conversations with Chat.
- In the upper-right corner, select GitLab Duo Chat. A drawer opens on the right side of your screen.
- Enter your question in the chat text box and press Enter or select Send.
- To create a new conversation with Chat, you can either:
- In the top-left corner of the Chat drawer, select New Chat.
- In the text box, type
/new
and press Enter or select Send. A new Chat drawer appears, replacing the previous Chat drawer.
There is no limit to the number of simultaneous conversations you can have with Chat.
{{< alert type=”note” >}}
When you use multiple conversations, the
/new
slash command replaces the/reset
or/clear
slash commands.{{< /alert >}}
-
To view all of your conversations, in the top-left corner of the Chat drawer, select Chat History.
Conversations created before the multiple conversations feature was enabled are not visible in the Chat history.
-
To switch between conversations, in your Chat history, select the appropriate conversation.
Every conversation persists an unlimited number of messages. However, only the last 25 messages are sent to the LLM to fit the content in the LLM’s context window.
Delete a conversation
To delete a conversation:
- In the top-left corner of the Chat drawer, select Chat History.
- In the Chat history, select Delete conversation.
By default, individual conversations expire and are automatically deleted after 30 days of inactivity. However, administrators can change this expiration period.
Use GitLab Duo Chat in the Web IDE
{{< history >}}
- Introduced in GitLab 16.6 as an experiment.
- Changed to generally available in GitLab 16.11.
{{< /history >}}
To use GitLab Duo Chat in the Web IDE on GitLab:
- Open the Web IDE:
- In the GitLab UI, on the left sidebar, select Search or go to and find your project.
- Select a file. Then in the upper right, select Edit > Open in Web IDE.
- Then open Chat by using one of the following methods:
- On the left sidebar, select GitLab Duo Chat.
- In the file that you have open in the editor, select some code.
- Right-click and select GitLab Duo Chat.
- Select Explain selected code, Generate Tests, or Refactor.
- Use the keyboard shortcut: ALT+d (on Windows and Linux) or Option+d (on Mac)
- In the message box, enter your question and press Enter or select Send.
If you have selected code in the editor, this selection is sent along with your question to the AI. This way you can ask questions about this code selection. For instance, Could you simplify this?
.
Use GitLab Duo Chat in VS Code
{{< history >}}
- Introduced in GitLab 16.6 as an experiment.
- Changed to generally available in GitLab 16.11.
- Status added in the GitLab Workflow extension for VS Code 5.29.0.
{{< /history >}}
Prerequisites:
To use GitLab Duo Chat in GitLab Workflow extension for VS Code:
- In VS Code, open a file. The file does not need to be a file in a Git repository.
- On the left sidebar, select GitLab Duo Chat ({{< icon name=”duo-chat” >}}).
- In the message box, enter your question and press Enter or select Send.
- In the chat pane, on the top right corner, select Show Status to show information in the Command Palette.
Select code and use Duo Chat
You can interact with Duo Chat while you’re working with a subset of code.
- In VS Code, open a file. The file does not need to be a file in a Git repository.
- In the file, select some code.
- Right-click and select GitLab Duo Chat.
- Select an option, or Open Quick Chat and ask a question, like
Can you simplify this code?
and press Enter.
Close Duo Chat
To close Duo Chat:
- For Duo Chat on the left sidebar, select GitLab Duo Chat ({{< icon name=”duo-chat” >}}).
- For the quick chat window that’s embedded in your file, in the upper-right corner, select Collapse ({{< icon name=”chevron-lg-up” >}}).
In the editor window
{{< history >}}
- Introduced as generally available in the GitLab Workflow extension for VS Code 5.15.0.
- Insert Snippet added in the GitLab Workflow extension for VS Code 5.25.0.
{{< /history >}}
To open GitLab Duo Chat in the editor window, use any of these methods:
- From a keyboard shortcut, by pressing:
- MacOS: Option + c
- Windows and Linux: ALT + c
- Right-clicking in the currently open file in your IDE, then selecting GitLab Duo Chat > Open Quick Chat. Optionally, select some code to provide additional context.
- Opening the Command Palette, then selecting GitLab Duo Chat: Open Quick Chat.
After Quick Chat opens:
- In the message box, enter your question. The available commands are shown while you enter text:
- Enter
/
to display all available commands. - Enter
/re
to display/refactor
.
- Enter
- To send your question, select Send, or press Command + Enter.
- Use the Copy Snippet and Insert Snippet links above code blocks in the responses to interact with them.
- To exit chat, either select the chat icon in the gutter, or press Escape while focused on the chat.
Use GitLab Duo Chat in Visual Studio for Windows
Prerequisites:
To use GitLab Duo Chat in the GitLab extension for Visual Studio:
- In Visual Studio, open a file. The file does not need to be a file in a Git repository.
- Open Chat by using one of the following methods:
- In the top menu bar, click on Extensions and then select Open Duo Chat.
- In the file that you have open in the editor, select some code.
- Right-click and select GitLab Duo Chat.
- Select Explain selected code or Generate Tests.
- In the message box, enter your question and press Enter or select Send.
If you have selected code in the editor, this selection is sent along with your question to the AI. This way you can ask questions about this code selection. For instance, Could you refactor this?
.
Use GitLab Duo Chat in JetBrains IDEs
{{< history >}}
- Introduced as generally available in GitLab 16.11.
{{< /history >}}
Prerequisites:
To use GitLab Duo Chat in the GitLab plugin for JetBrains IDEs:
- In a JetBrains IDE, open a project.
- Open GitLab Duo Chat in either a chat window or an editor window.
In a chat window
To open GitLab Duo Chat in a chat window, use any of these methods:
- On the right tool window bar, by selecting GitLab Duo Chat.
- From a keyboard shortcut, by pressing:
- MacOS: Option + d
- Windows and Linux: ALT + d
- In the file that you have open in the editor:
- Optional. Select some code.
- Right-click and select GitLab Duo Chat.
- Select Open Chat Window.
- Select Explain Code, Generate Tests, or Refactor Code.
- Adding keyboard or mouse shortcuts for each action under Keymap in the Settings.
After GitLab Duo Chat opens:
- In the message box, enter your question. The available commands are shown while you enter text:
- Enter
/
to display all available commands. - Enter
/re
to display/refactor
and/reset
.
- Enter
- To send your question, press Enter or select Send.
- Use the buttons within code blocks in the responses to interact with them.
In GitLab Duo Quick Chat in the editor view
{{< history >}}
- Introduced as generally available in the GitLab Duo plugin for JetBrains 3.0.0 and GitLab Workflow extension for VS Code 5.14.0.
{{< /history >}}
To open GitLab Duo Chat Quick Chat in the editor window, use any of these methods:
- From a keyboard shortcut, by pressing:
- MacOS: Option + c
- Windows and Linux: ALT + c
- In the currently open file in your IDE, by selecting some code, then, in the floating toolbar, selecting GitLab Duo Quick Chat ({{< icon name=”tanuki-ai” >}}).
- Right-clicking, then selecting GitLab Duo Chat > Open Quick Chat.
After Quick Chat opens:
- In the message box, enter your question. The available commands are shown while you enter text:
- Enter
/
to display all available commands. - Enter
/re
to display/refactor
and/reset
.
- Enter
- To send your question, press Enter.
- Use the buttons around code blocks in the responses to interact with them.
- To exit chat, either select Escape to close, or press Escape while focused on the chat.
Watch a demo and get tips
For tips and tricks about integrating GitLab Duo Chat into your AI-native DevSecOps workflows, read the blog post: 10 best practices for using AI-powered GitLab Duo Chat.
View examples of how to use GitLab Duo Chat.
Configure Chat conversation expiration
{{< history >}}
- Introduced in GitLab 17.11.
{{< /history >}}
You can configure how long conversations persist before they expire and are automatically deleted.
Prerequisites:
- You must be an administrator.
- On the left sidebar, at the bottom, select Admin.
- Select GitLab Duo.
- In the lower-right corner, select Change configuration.
-
In the GitLab Duo Chat conversation expiration section, select either of the following options:
- Expire conversation based on time conversation was last updated.
- Expire conversation based on time conversation was created.
- Select Save changes.
Give feedback
Your feedback is important to us as we continually enhance your GitLab Duo Chat experience. Leaving feedback helps us customize the Chat for your needs and improve its performance for everyone.
To give feedback about a specific response, use the feedback buttons in the response message. Or, you can add a comment in the feedback issue.