Harness the power of code generation directly in your Domino Workspace. Domino has built-in coding assistants to help accelerate your productivity with a wide variety of tasks, including data preparation, analysis, training machine learning models, and more. Domino provides flexibility to use the best tools while also allowing administrative control to honor and enforce the security and privacy policies of your company. This article will guide you through multiple options to help you choose the best for your needs.
Jupyter AI gives data scientists an on-demand AI coding assistant to save time on mundane tasks and simplify complex ones. This helps you boost productivity by generating code that can fix errors, summarize content, ask questions, and even generate entire notebooks from natural language prompts. It also works with multiple IDEs, including notebook-based IDEs like VS Code and Jupyter Notebook, with Jupyter AI magic commands. With JupyterLab, you have access to the Jupyternaut chat interface.
UI-based Jupyternaut chatbot (JupyterLab)
To explore the Jupyternaut chatbot:
-
Create a new Workspace. Select JupyterLab and Domino Standard Environment for your Environment.
-
In JupyterLab, click on the chat icon in the left panel to open the chat interface.
To learn how to configure and use Jupyternaut, visit Jupyter AI’s official documentation.
Inline coding assistance with %ai and %%ai magic commands
Access Jupyter AI in notebook IDEs such as Jupyter and VS Code using the %ai
and %%ai
magic commands.
-
Create a new Workspace. Select Jupyter Notebooks and Domino Standard Environment for your Environment.
-
Get an API key from your LLM provider. For example, OpenAPI users can find their API keys on their OpenAI API Keys page.
-
In a notebook, update the environment variable matching the API key for your preferred LLM provider. For ChatGPT, use the
OPEN_AI_KEY
variable.%env OPEN_API_KEY = <YOUR_OPEN_API_KEY>
TipYou can use Domino environment variables to securely store credentials like API keys. -
Load the AI Magic extension with
%load_ext jupyter_ai_magics
.
You can now use the %ai
magic to call your CodeGen assistant. For more information, refer to the official Jupyter AI magic commands documentation.
Install Jupyter AI in a custom Environment
To avoid repeating the previous steps every time you launch a Workspace, you can pre-configure your Environments to store the API key as an environment variable and pre-enable the %%ai
magic extensions:
-
In Domino, click Environments > select your Environment > Edit definition > Dockerfile instructions.
-
Add the following Dockerfile instructions to save your API key as an environment variable:
ENV OPENAI_API_KEY=<Your OpenAI Key>
-
To enable the Magic Extension for JupyterAI, add the following code:
RUN ipython profile create && echo "c.InteractiveShellApp.extensions=['jupyter_ai_magics']" >> /home/ubuntu/.ipython/profile_default/ipython_config.py
Domino supports a diverse array of coding assistants, including GitHub Copilot, to enhance the development experience within VS Code workspaces. GitHub Copilot is an AI-powered code completion tool that assists developers by suggesting whole lines or blocks of code as they type. It’s like having a pair of expert eyes that help you code faster and learn new APIs and languages along the way.
To set up and use GitHub Copilot from within VS Code on Domino, follow the steps below.
Step 1: Install VS Code in Domino
Ensure that VS Code is installed and properly configured in your Domino Environment. If VS Code is not yet installed, refer to the Domino documentation on setting up development environments to integrate VS Code.
Step 2: Download the GitHub Copilot VSIX
-
Go to the GitHub Copilot extension page on the Visual Studio Marketplace.
-
Look for the Download Extension link on the right side of the page and download the
.vsix
file. Ensure you save this file to a location accessible from your Domino Environment.
Step 3: Install GitHub Copilot in VS Code
-
Launch VS Code from your Domino Workspace.
-
Open the Extensions view by clicking on the square icon on the sidebar or pressing
Ctrl+Shift+X
. -
Click on the … (More Actions) button at the top of the Extensions view.
-
Select Install from VSIX… from the dropdown menu.
-
Locate the
.vsix
file you downloaded earlier and select it to start the installation.
Step 4: Connect to GitHub Copilot
-
Once the installation is complete, sign in to GitHub to activate GitHub Copilot.
-
Follow the prompts in VS Code to sign in to your GitHub account. This may require generating a token from your GitHub account.
-
After signing in, enable GitHub Copilot by accessing the command palette (
Ctrl+Shift+P
), typing “Copilot”, and selecting GitHub Copilot: Enable. -
If prompted, configure any additional settings according to your preferences.