Harness the power of code generation directly in your Domino Workspace. Jupyter AI gives data scientists an on-demand AI coding assistant to save time on mundane tasks and simplify complex ones. Boost productivity by using Jupyter AI to generate code, fix errors, summarize content, ask questions, and even generate entire notebooks from natural language prompts.
Jupyter AI works with many IDEs. With JupyterLab, you have access to the Jupyternaut chat interface. But you can also use notebook-based IDEs like VS Code and Jupyter Notebook with Jupyter AI magic commands.
Domino Standard Environments (DSEs) come pre-installed with Jupyter AI so you can quickly get started with CodeGen models from providers like OpenAI, Azure Chat, HuggingFace, Sagemaker, and more.
To explore the Jupyternaut chatbot:
-
Create a new Workspace. Select JupyterLab and Domino Standard Environment for your Environment.
-
In JupyterLab, click the chat icon in the left panel to open the chat interface.
To learn how to configure and use Jupyternaut by visiting Jupyter AI’s official documentation.
Use %ai and %%ai magic commands in notebooks
Access Jupyter AI in notebook IDEs such as Jupyter and VS Code using the %ai
and %%ai
magics.
-
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 in 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, see Jupyter AI magic commands official docs.
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 line:
RUN ipython profile create && \ echo "c.InteractiveShellApp.extensions=['jupyter_ai_magics']" >> /home/ubuntu/.ipython/profile_default/ipython_config.py