IntelliJ IDEA 2024.2 Help

AI Assistant in Jupyter notebooks

Install the AI Assistant plugin

This functionality relies on the AI Assistant plugin, which you need to install and enable.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Marketplace tab, find the AI Assistant plugin, and click Install (restart the IDE if prompted).

Use Jupyter-specific AI features in IntelliJ IDEA to explain Jupyter cells and DataFrames, create new cells and visualizations, edit cells, and fix errors in your code.

Explain with AI

Explain Jupyter cell

  1. Open a Jupyter notebook and do one of the following:

    • Right-click the cell to open the context menu.

    • Press Alt+Enter.

  2. Select AI Actions and then Explain Code.

  3. Select Jupyter Cell or Whole Jupyter File.

    Explain Jupyter cell
  4. The AI Assistant tool window will open to provide a detailed description of the Jupyter file or selected cell.

Explain DataFrame

  1. Click AI Actions in the upper-right corner of the output cell and select Explain DataFrame.

    Explain dataframe action
  2. The AI Assistant tool window will open to provide a detailed description of the DataFrame.

Create cells and visualizations

Create code cell from snippet

You can create a new code cell with AI-generated code in your Jupyter notebook.

  1. Open or create an .ipynb file.

  2. Click Insert Snippet as Jupyter Cell in the upper-right corner of the field with the generated code.

Create AI cell

AI can create a new cell with AI-generated code based on your request.

  1. Click the AI button in between cells.

    Select AI from the button
  2. Type your request in the AI Assistant input field and click Send or use AI suggestions.

  3. AI Assistant will generate a code for the new cell:

    Accept the code suggestion
  4. Select Accept and Run to add the code to the cell and run it as-is or Accept to add the code to the cell and continue working on it.

Create visualizations

  1. Click AI Actions in the upper-right corner of the output cell and select Suggest visualizations.

    AI actions
  2. The AI Assistant tool window will open to provide AI-generated code snippets for several visualizations.

    Visualization code snippets generated by AI Assistant
  3. Select one of the following options:

    • Copy the suggested code to the clipboard.

    • Insert code into the editor at the caret position.

    • Create a new file from the snippet.

    • Create a new code cell from the snippet.

Edit cells

AI Assistant can help you modify existing cells.

  1. Right-click the cell you want to edit.

  2. Select AI Edit Cell from the context menu.

    Select AI Edit Cell
  3. Type your request in the AI Assistant input field and click Send or use AI suggestions.

  4. AI Assistant will generate new code.

  5. Select Accept and Run to add the code to the cell and run it as-is or Accept to add the code to the cell and continue working on it.

Use AI suggestions

AI Assistant can analyze your notebook data and offer you a choice of prompts for code suggestions.

  1. Click the Suggestions Suggestions icon on the right side of an AI input field.

  2. Choose one of the suggested prompts. The selected prompt, combined with notebook data sent for analysis, will be used for code generation.

    Prompts suggested by AI

Fix errors

When your notebook or cell execution fails with an error, the AI Fix Cell option appears in the context menu.

  1. Right-click the cell you want to fix.

  2. Select AI Fix Cell from the context menu.

    Select Fix Cell from the context menu
  3. AI Assistant will generate new code with the error fixed.

  4. Select Accept and Run to add the code to the cell and run it as-is or Accept to add the code to the cell and continue working on it.

Last modified: 05 August 2024