✨ Discovering GitLab Duo 🤖
Tags: gitlab, ai, devops
Published: 2024-04-10 21:50:49

## ✨ Artificial Intelligence

Artificial Intelligence (AI) is everywhere: in your email, translation, social networks, streaming, IOT, image generators and for some months, in development tools.

Some people, especially those unfamiliar with software development, might fear that AI will replace developers’ jobs. True? Perhaps, but not anytime soon. This debate will not be part of this blog post. 

I prefer asking myself why not use AI to help us to accelerate software development?

Last year, GitLab introduced a new project : GitLab Duo. I heard about this while attending [GitLab DevSecOps World Tour in Paris]([https://about.gitlab.com/events/devsecops-world-tour/paris/](https://about.gitlab.com/events/devsecops-world-tour/paris/)). This was a great day with talks, workshops and a lot of discussions.

![Tweet du DevSecOps World Tour Paris](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v26ib0goj0jdxswio24y.png)



## 🤖 GitLab DUO : AI 

GitLab has launched this new project with a new branding for it, highlighting its focus on AI integration within the DevOps platform. The number of features it brings spotlight the importance of this project for GitLab. I am sure that this project is at the top of the priorities for the GitLab teams. GitLab has a partnership with Google, and I am not surprised to see that GitLab and Google teams work together to deliver great features for the future. I am excited to see how the power of GitLab and Google will bring AI in our life.

![GitLab Duo branding](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c0kvfwffflsp4tm1a50u.png)


GitLab Duo introduces AI in the entire DevOps lifecycle, helping from issue management to the code completion and also security of your project. 

In order to handle the big scope of this project, GitLab has splitted the project into sub-projects, like Code **Suggestion** and **GitLab Duo Chat**.

These features are still in progress. To enjoy them, you can activate in your GitLab group this property : “Use Experiment and Beta features” available in the menu _Settings > General > Permissions and group features > Experiment and Beta features._


## Code suggestion 

The first one I would like to speak about is Code **Suggestion. **This continuously improving feature is currently available, since April 2024, through the GitLab Duo Pro add-on. I learned that GitLab offers the possibility to use add-on in their platform with this project (cf GitLab Duo Pro paragraph).

Code suggestion offers multiple ways to interact with in: directly in the GitLab WebIDE, in Vscode (with [VS Code GitLab Workflow extension](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow)), Jetbrains (with [GitLab Duo plugin](https://plugins.jetbrains.com/plugin/22325-gitlab-duo)),  and Neovim (with [this plugin](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim)). 

This powerful feature helps developers by suggesting code completions, such as an entire Javascript function or a Kubernetes descriptor, in real time as you type. Code Suggestion check comments you are typing and will attempt to generate the associated code as you can see in this example: 

![Code Suggestion](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/poipha4r8qyjnpn9p2dn.png)

Pressing the Tab key inserts the suggested code into your file.  

![Code add in your code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ib2hecq9pgu2sisp0nhx.png)


Code Suggestion supports around 14 languages, including Go, Python, Java, Javascript, PHP and Rust). However, please check this page to verify the availability of your language in your IDE: [https://docs.gitlab.com/ee/user/project/repository/code_suggestions/supported_extensions.html#supported-languages](https://docs.gitlab.com/ee/user/project/repository/code_suggestions/supported_extensions.html#supported-languages). 


## 💬 GitLab Duo Chat

With the rise of AI tools in development, many people use them to ask anything about development, or to get  advice on technical things. 

That’s why GitLab introduced a new AI assistant, **GitLab Duo Chat**. 

It is a chat available in the GitLab UI, on Web IDE, and on Vs Code. Its goal is to help you respond to your questions without leaving GitLab. Having this in GitLab is a great advantage and allows you to stay in the same  tab to interact with AI.

It is available on the menu at the bottom left of your screen 

<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r00hfqhsn7fpgv74yev1.png" alt="Acces to GitLab Duo Chat" height=100/>

<img alt="GitLab Duo Chat" src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rn0taai0ts5x02lpa8f7.png" height=100/>

and recently with a button at the top on the left.

![Button on the top of GitLab UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/43vn0vgtc3shxk2z7q9x.png)

You can for example ask GitLab Duo Chat how to create a Go project, initiate a GitLab CI pipeline or explain how to start with a `.gitignore` file for a Java project.

![Example of a response by GitLab Duo Chat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkmngom2ceioazrm3kgs.png)


GitLab Duo Chat can also explain selected code. If you open a file in GitLab: 

![Display a tooltip to explain selected code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/llk6snknrfer0wqzyo59.png)

You can select code and click the “?” icon.

![Explanation by GitLab Duo Chat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jo18h8801zrg7o7e7qis.png)

Of course you can also write the command directly after selecting the code you want to get explanations.


## 🌏 IA is everywhere in GitLab 

AI in GitLab is not limited to Code Suggestion and GitLab Duo Chat. From issue management to supervision of your application, GitLab integrated AI in all the software DevOps lifecycle.

![DevSecOps representation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8yf5vbswok0akoium9lr.png)
_From https://about.gitlab.com/press/press-kit/_


### Plan 

Issues are the backbone of project planning in GitLab. Now, the “AI actions” button offers a single button to generate a description using the power of AI:

![AI tooltip](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ewybl5r3ubgj90orys2o.png)

![AI actions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6eo41xk42j37cc7w7e5.png)

![Generate description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gce8cb7hpgog3pm9urp1.png)


From this text :  
```
in this issue I would like to initiate a new API working on Nantes communities_
```

GitLab Duo generates this description: 

```
_#1 - New API for Nantes communities_

_The goal of this issue is to initiate development of a new API focused on serving data related to communities in Nantes, France. This API would provide programmatic access to information about various neighborhoods, organizations, events and other data relevant to residents and groups in the city._

_***_

__Description was generated using AI__
```

This feature is an effective way to improve the quality of the description.

Another AI functionality in issues is the summary. When you read or work on an issue, with a lengthy description and many comments, it’s easy to miss important information. GitLab Duo offers the “View summary” button to automatically generate a summary of the issue. 

![View summary button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgq4us9oe5vdrc0fet5d.png)

The generated summary is visible only by users who activated this feature. For [this issue]([https://gitlab.com/gitlab-org/gitlab/-/issues/409844](https://gitlab.com/gitlab-org/gitlab/-/issues/409844)), this is the summary proposed by GitLab Duo:

![Text generated by AI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jze5whi93bz2ol7qsffw.png)


### Code 

In addition to code, GitLab Duo extends features to merge requests (MR).  First, it integrates with Code Owners files, helping users to assign the most suitable reviewer for an issue. 

AI can also help to describe your merge requests. The “Summarize code changes” button provides you with a summary of your modifications, saving you time and effort. GitLab Duo can also summarize comments on a merge request.
</p>


![Summarize code changes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8e4w39ho0jd5lklje6zx.png)


### Test

Writing tests can be a repetitive task. To help developers, GitLab Duo comes with the “/tests” command which generate test suggestions for the code selected:

![Tests suggestion](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2aqybctioum4wc3vzafs.png)

### Deployment

With the “Root cause analysis” feature, GitLab Duo brings AI within the CI/CD to explain the cause of your failure.

![Root cause analysis button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7xpmpb02j5rgduf0a8z.png)


### Security

Security vulnerabilities are critical on a project and require quick attention. GitLab Duo helps users to understand these vulnerabilities and can create a merge request to resolve them.

All features are detailed [here](https://about.gitlab.com/gitlab-duo/#features).


## 👷 GitLab Duo Pro 

GitLab introduced [in this blog post](https://about.gitlab.com/blog/2024/01/17/gitlab-duo-pro/) (published earlier in this year) an Add-on called GitLab Duo Pro. Available for Ultimate and Premium customers, it boosts developer efficiency. Privacy is a major concern with AI. That’s why GitLab released GitLab Duo as an experimental project. The GitLab Duo Pro add-on assures users that their code stays confidential and is not used to train their AI models.


![Try GitLab Duo Pro free](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1c2z15mx8ty0tu87ikbk.png)

![GitLab Duo Pro Add on](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hskzaj1w0xym8qqkv1so.png)


## 🚀 The next steps

AI won’t replace developers, but it will become a great daily friend. GitLab Duo will boost developers efficiency and offer the possibility to create projects faster while assisting for taks we are less comfortable with.

This project is truly promising and I can't wait to see new features rolling out with each release of GitLab.

🙏 Thanks to [Guillaume](https://www.linkedin.com/in/guillaume-lefloch) and [Jimmy](https://www.linkedin.com/in/jimmy-kasprzak) for their review.

## Links

* [https://about.gitlab.com/gitlab-duo/](https://about.gitlab.com/gitlab-duo/)
* [https://about.gitlab.com/blog/2024/04/02/10-best-practices-for-using-ai-powered-gitlab-duo-chat](https://about.gitlab.com/blog/2024/04/02/10-best-practices-for-using-ai-powered-gitlab-duo-chat)
* [https://about.gitlab.com/blog/2024/01/17/gitlab-duo-pro/](https://about.gitlab.com/blog/2024/01/17/gitlab-duo-pro/)
* [https://about.gitlab.com/releases/2023/07/22/gitlab-16-2-released/#gitlab-duo-code-suggestions-improvements-powered-by-google-ai](https://about.gitlab.com/releases/2023/07/22/gitlab-16-2-released/#gitlab-duo-code-suggestions-improvements-powered-by-google-ai)