GitLab Duo Chat became generally available in GitLab 16.11 and its power as a personal assistant can not be overstated. On a DevSecOps platform, more has to happen than just generating code; planning, discussions, security, compliance, and technical reviews are all critical to developing secure software faster. Issues, epics, merge requests, and other sections of GitLab are where this work happens, with knowledge often buried deep in comment threads. It can take a lot of time to get up to speed on these threads, especially when they've grown to hundreds of comments and interactions and when you've been away from them for a while. This is where GitLab Duo Chat can help.
In this first part of our GitLab Duo Chat 101 series, we'll introduce you to Chat's capabilities and then dig into how to use Chat to summarize comment threads.
Live demo! Discover the future of AI-driven software development with our GitLab 17 virtual launch event. Register today!
GitLab Duo Chat's capabilities
With Chat, you can refactor existing code, learn how a block of code works, and write tests for your code, learn about your issues and epics, and much more. Depending on your prompts, you can make Chat do impressive things that boost developer productivity. In the video below, I showcased how you can use GitLab Duo Chat to interact with GitLab and learn about your issues and epics.
Use cases
GitLab Duo Chat’s capabilities allow for productivity gains across multiple parts of the software development lifecycle:
- Product and project managers can use Chat’s issues and epics capabilities to gain insights into discussions and plan faster.
- Developers can create solutions faster with code suggestions and refactoring capabilities. When it comes to working with legacy code or code from other team members, less time is spent on research with the
/explain
capability providing the necessary insights to understand the code. - Quality assurance and test engineers can generate tests and check for vulnerabilities
- New employees can get a better understanding of their code base and get started solving problems.
- Beginner programmers can understand and pick up a language or framework quickly and create solutions with Chat providing next steps and insights.
Check out "10 best practices for using GitLab Duo Chat" for tips and tricks to craft AI prompts.
Summarizing issues
When you encounter an issue, especially one with a lot of comments, you skim through the issue description, along with a couple of comments, but can't always get the complete picture of the conversations. GitLab Duo Chat can get you up to speed fast. In the image below, I asked Chat to summarize an issue along with a follow-up question. In two prompts, I got what I needed to understand what is going on in the issue without spending hours reading through the comments.
You can use GitLab Duo Chat on the GitLab interface, as well as the WebIDE, Visual Studio Code, and JetBrains interfaces.
Prompts and context
Getting the best responses from any AI tool requires carefully crafting the questions asked. Sometimes, you need to give examples of the responses you expect to prime the large language models (LLMs) toward a desired response. Here are some areas to focus on to get desired responses.
Context
Here are three prompts with similar objectives but worded differently:
Prompt 1 | Prompt 2 | Prompt 3 |
---|---|---|
The context, “this issue,” is common among the three prompts; this tells Chat what resource to use in looking for answers. Prompt 1 gives additional context on what to focus on: the description of the issue. Prompt 2 is not limited in its scope, which means the LLMs will spend more time going through the description and all the comments to provide a more detailed summary of the whole issue. (Note: As of the publication of this blog, there were more than 90 comments in that issue.) Prompt 3 got a poorer response because not much expectation was set for the type of response expected.
Low-context communication is critical in crafting your prompt for the best responses, as all information needed for the LLMs to provide an informed response is provided.
Simplicity
The wordiness of prompts can sometimes lead to incorrect or no responses. In the image below, you can see that rephrasing a prompt from “Customers have mentioned why this issue is important to them. Can you list the top 3 reasons they mentioned?” to “Why is this issue important to customers?” led to the expected response. When you don’t get the response you desire, simplifying or changing the words used in your prompt can improve the quality of responses.
Follow-up questions
GitLab Duo Chat can have follow-up conversations – an essential capability. In the image below, I continued asking how the issue in question can be solved in GitLab's code along with a follow-up question asking for code samples.
Follow-up questions allow the application to maintain context and provide faster responses. A recommendation is to provide parts of Chat’s previous responses in the next prompt. In the example above, I mentioned “Rails App,” as previously suggested.
Get started with GitLab Duo Chat
GitLab Duo Chat does more than help you write better code, it helps you navigate through problems and quickly find solutions. With the right prompts and context, you can build secure software faster.
Want to try GitLab Duo Chat? Start your free trial today.