Integrating Duet AI into Development Workflow: How developers can seamlessly integrate Duet AI into their existing development workflow

Robina Mirbahar
Google Cloud - Community
5 min readJan 29, 2024

--

Introduction

In this tutorial, we will walk you through the process of setting up and using Duet AI to enhance your coding projects.

Step 1: Installation and Setup

The first step is to install and set up Duet AI in your development environment. Duet AI and follow the instructions for your preferred code editor or IDE. Once installed, authenticate your account to gain access to its powerful features.

Step 2: Enabling Duet AI

After installation, enable Duet AI within your code editor or IDE. This will activate its intelligent code completion and suggestion capabilities.

Step 3: Starting a Coding Project

“Now, let’s start a coding project. Open your preferred code editor or IDE and create a new project or open an existing one. Ensure that your project is properly configured with the necessary dependencies and settings.”

Prerequisites:

Before we begin, ensure you have:

  1. Google Cloud Workstation set up.

Note: Setting up a Google Cloud Workstation may result in charges. To prevent unexpected charges, it is advisable to regularly review your active resources to identify any unused ones. Subsequently, terminate these unnecessary resources to halt future charges.

2. Node.js and npm installed.

3. A Duet AI account with API credentials.

Use Duet AI in an IDE

A working development environment with your preferred IDE.

As a developer, I initiated the setup of my preferred Integrated Development Environment (IDE) on Cloud Workstations. The initial step involved configuring my workstation, with the first action being the activation of the Workstations API.

Configuration Workstation 01
Configuration Workstation 02

Create a Workstation

Creating Workstation

The workstation named “tutorialforduetai” has been generated. Simply click on “start” to launch the workstation.

launch Workstation

In the Google Cloud console, launch your workstation.

Connect to Google Cloud

Connect

Inside your code editor, click on “Connect to Google Cloud” in the status bar and follow the instructions to log in to Google Cloud.

Enable Duet AI in Cloud Code

After enabling the workstation API, enable Duet AI within your code editor or IDE. This will activate its intelligent code completion and suggestion capabilities.

In this step, enable Duet AI in Cloud Code. Before you proceed with these steps, make sure to follow the instructions in Set up Duet AI for a project, if you haven’t already.

To enable Duet AI in Cloud Code for your IDE, follow these steps:

  1. In your IDE, select Code (for MacOS) or File (for Windows and Linux), and then navigate to Settings > Settings.
  2. On the User tab of the Settings dialog, navigate to Extensions > Google Cloud Code.
  3. Scroll until you find Duet AI: Enable, and then select the Enable Duet AI for developers checkbox.
  4. Reload your IDE.
Enable Extentions
Google Cloud Code
Enable
Duet Ai

Chat with Duet AI

Chat with Duet Ai

In the activity bar of your IDE or workstation, click

icon

Duet AI.

Create a sample application

Creates a folder for workspace.

Creating Application

Create an Express Application

  • Create a simple Express application for your project. For example, create an index.js file:

In the activity bar of your IDE or workstation, click

Duet AI.

In the Duet AI: Chat pane, enter Explain this code to me and click

Send.

Disclaimer: Responses obtained from the model may vary due to its non-deterministic nature. The dynamic nature of the language model contributes to diverse and context-specific outputs.

Generate Reponses

To run the web server, you can use the following command:

node index.js

Conclusion:

Congratulations! 🎉 You have successfully integrated Duet AI into your development workflow. By leveraging its intelligent code completions, code generation capabilities, and collaborative features, you can enhance your coding projects and boost productivity. Happy Coding! 🚀

Thanks for reading!

Connect with me: Linkedin Instagram

--

--

Robina Mirbahar
Google Cloud - Community

🚀 𝐀𝐖𝐒 𝐂𝐥𝐨𝐮𝐝 𝐄𝐧𝐠𝐢𝐧𝐞𝐞𝐫 ☁️|| 𝟐𝐱𝐀𝐖𝐒 𝐂𝐞𝐫𝐭𝐢𝐟𝐢𝐞𝐝 || 𝐀𝐖𝐒 𝐒𝐨𝐥𝐮𝐭𝐢𝐨𝐧𝐬 𝐀𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭☁️ || 𝐅𝐫𝐞𝐞𝐥𝐚𝐧𝐜𝐞𝐫 ☁️||