GitLab Duo Chat

Tier: Premium with GitLab Duo Pro, Ultimate with GitLab Duo Pro or Enterprise - Start a trial Offering: GitLab.com, Self-managed, GitLab Dedicated
History

GitLab Duo Chat is your personal AI-powered assistant for boosting productivity. It can assist various tasks of your daily work with the AI-generated content.

Supported editor extensions

You can use GitLab Duo Chat in:

note
If you have self-managed GitLab: 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.

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.

In the GitLab UI, GitLab Duo Chat knows about these areas:

Area How to ask Chat
Epics From the epic, ask about this epic, this, or the URL. From any UI area, ask about the URL.
Issues From the issue, ask about this issue, this, or the URL. From any UI area, ask about the URL.
Code files From the single file, ask about this code or this file. From any UI area, ask about the URL.
Merge requests From the merge request, ask about this merge request, this, or the URL. For more information, see Ask about a specific merge request.
Commits From the commit, ask about this commit or this. From any UI area, ask about the URL.
Pipeline jobs From the pipeline job, ask about this pipeline job or this. From any UI area, ask about the URL.

In the IDEs, GitLab Duo Chat knows about these areas:

Area How to ask Chat
Selected lines in the editor 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 Ask about the URL.
Issues Ask about the URL.

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.

Duo Chat always has access to:

  • GitLab documentation.
  • General programming and coding knowledge.

We are continuously working to expand contextual awareness of Chat to include more types of content.

Use GitLab Duo Chat in the GitLab UI

  1. In the upper-right corner, select GitLab Duo Chat. A drawer opens on the right side of your screen.
  2. Enter your question in the chat input box and press Enter or select Send. It may take a few seconds for the interactive AI chat to produce an answer.
  3. 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.

note
Only the last 50 messages are retained in the chat history. The chat history expires 3 days after last use.

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.

To use GitLab Duo Chat in the Web IDE on GitLab:

  1. Open the Web IDE:
    1. In the GitLab UI, on the left sidebar, select Search or go to and find your project.
    2. Select a file. Then in the upper right, select Edit > Open in Web IDE.
  2. 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.
      1. Right-click and select GitLab Duo Chat.
      2. Select Explain selected code, Generate Tests, or Refactor.
    • Use the keyboard shortcut: ALT+d (on Windows and Linux) or Option+d (on Mac)
  3. 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.

To use GitLab Duo Chat in GitLab Workflow extension for VS Code:

  1. Install and set up the Workflow extension for VS Code:
    1. In VS Code, download and install the GitLab Workflow extension for VS Code.
    2. Configure the GitLab Workflow extension.
  2. In VS Code, open a file. The file does not need to be a file in a Git repository.
  3. 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.
      1. Right-click and select GitLab Duo Chat.
      2. Select Explain selected code or Generate Tests.
    • Use the keyboard shortcut: ALT+d (on Windows and Linux) or Option+d (on Mac)
  4. 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?.

In the editor window

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
  • In the currently open file in your IDE, by selecting some code.
  • Right-clicking, then selecting GitLab Duo Chat > Open Quick Chat.

After Quick Chat opens:

  1. 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.
  2. To send your question, select Send, or press Command + Enter.
  3. 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

To use GitLab Duo Chat in the GitLab extension for Visual Studio:

  1. Install and set up the extension for Visual Studio:
    1. In Visual Studio, download and install the GitLab extension for Visual Studio.
    2. Configure the GitLab extension for Visual Studio.
  2. In Visual Studio, open a file. The file does not need to be a file in a Git repository.
  3. 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.
      1. Right-click and select GitLab Duo Chat.
      2. Select Explain selected code or Generate Tests.
  4. 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.

To use GitLab Duo Chat in the GitLab Duo plugin for JetBrains IDEs:

  1. Install and set up the GitLab Duo plugin for JetBrains IDEs:
    1. In the JetBrains marketplace, download and install the GitLab Duo plugin.
    2. Configure the GitLab Duo plugin.
  2. In a JetBrains IDE, open a project.
  3. 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:
    1. Optional. Select some code.
    2. Right-click and select GitLab Duo Chat.
    3. Select Open Chat Window.
    4. 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:

  1. 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.
  2. To send your question, press Enter or select Send.
  3. Use the buttons within code blocks in the responses to interact with them.

In the editor window

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
  • In the currently open file in your IDE, by selecting some code, then, in the floating toolbar, selecting GitLab Duo Quick Chat ().
  • Right-clicking, then selecting GitLab Duo Chat > Open Quick Chat.

After Quick Chat opens:

  1. 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.
  2. To send your question, press Enter.
  3. Use the buttons around code blocks in the responses to interact with them.
  4. 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-powered 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.

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.