Datalore 2024.2 Help

Use AI assistance

The AI assistance functionality helps you code faster and better with the support of code generation and modification via natural language commands. You can use it when coding in Python, R, and SQL, as well as working in Markdown cells.

You can use the functionality as the following tools:

  • In-cell Ask AI tool: used to generate code suggestions for the cell you are working on, based on the provided prompt and the data from the previous cells of the notebook

  • Standalone Autopilot tool: used to generate code suggestions for further cells. The code suggestions are either based on solely notebook content analysis or an 'objective' specified by the user. Additionally, the tool can be used for the next cell only in the same way you use Ask AI.

Before you start

Check feature accessibility

Visit this page to make sure the AI service for JetBrains is permitted in your country.

Accept terms and conditions

The step is required to ensure transparency and data protection.

Limitations

At the moment, the feature is available to all users. However, in future versions, it will only be available to paid plan users.

AI usage is limited to 20 requests per 3 hours.

Enable AI assistance in Datalore Enteprise

Perform the following steps on the Admin panel to enable the functionality:

  1. Click the avatar in the upper right corner of the screen and select Admin panel.

    Opening Admin panel
  2. On the Admin panel, navigate to Configuration.

  3. On the Configuration tab, select the Turn on AI assistance checkbox.

    Configuration tab
  4. Read the terms of service and click the Accept button below.

Use Ask AI

The procedures in this chapter describe how to use AI in a selected cell with the help of the Ask AI tool.

Generate code using Ask AI

The procedure below explains how to use the Ask AI tool to generate or modify code or Markdown.

  1. On the toolbar of the cell, click the Ask AI icon. A prompt box will appear in the cell.

    Ask AI in a code cell
  2. Click the Settings icon in the right part of the Autopilot toolbar and use the following options to customize how data is sent for analysis:

    1. Review prompt: select to review and select which cells to send for analysis.

    2. Include outputs: select to send outputs for analysis, which improves suggestion quality but uses more data.

    With review option
  3. Provide a prompt using natural language and click the Generate icon.

  4. (If Review prompt is selected) Do the following in the Review of generated prompt:

    1. Deselect the cells you do not want to send for analysis.

    2. Click the Submit button to send the reviewed data for analysis.

      Reviewing prompt
  5. After the code suggestion is submitted, you have the following options:

    • Accept and run (for code cells only): to add the code to the cell and run it as-is

    • Accept: to add the code to the cell and continue working on it

    • Copy to clipboard: to copy the code suggestion to clipboard

    Code suggestion in diff view

Example of generating code for a new cell

The command provided using Ask AI was 'generate table from player_stats.csv'

Table generated from csv file with Ask AI

Example of modifying code in a cell

  • The first command provided to Ask AI was 'Show correlation diagram between Pos and AST'. The resulting code produced a heatmap plot diagram.

    Heatmap plot diagram produced by Ask AI
  • The next step was modifying the code by prompting Ask AI to change the graph to a bar chart using hues of the red color.

    Bar chart after code modification with Ask AI

Use Autopilot

Autopilot is an AI-based feature that suggests code based on the analysis of your current notebook content or an objective that you explicitly define. Code suggestions are generated in one of the following scenarios:

  • You ask the AI assistant for auto-generated prompts and then choose one of them for the AI assistant to generate a code suggestion.

  • To get better tailored auto-generated prompts from the AI assistant, you set a custom objective, which will persists through the notebook until you change or clear it.

  • You provide your own prompt for the AI assistant in the same way you would when using Ask AI.

While the in-cell Ask AI tool is used when working on a selected cell, the Autopilot tool works on a larger scale and focuses on the further development of the entire notebook.

Open and set up Autopilot

  1. Open the Autopilot tool by clicking the Open Autopilot icon. This icon is always shown under the current last cell in the notebook or under any other cell when hovering over that cell.

    Open Autopilot icon hovered over
  2. Click the Settings icon in the right part of the Autopilot toolbar and use the following options to set up how to use the tool:

    1. Review prompt: select to review and select which data to send for analysis and modelling.

    2. Auto-mode: select to enable triggering Autopilot after every computation completion.

    3. Include outputs: select to send outputs for analysis and modelling, which improves suggestion quality but uses more data.

    Autopilot settings

Get code suggestions with prompts from Autopilot

This is the general-flow procedure where Autopilot creates prompts (Advice) based on notebook analysis or custom notebook objective and generates code suggestions following the selected prompt.

  1. Click the Get Advice from AI icon in the left corner of the Autopilot toolbar.

    (Optional>If you selected Review prompt, select which cells to send for analysis in the Review of generated prompt window.

    Review of generated prompt

    The AI assistant will offer you a choice of up to four prompts for code suggestions based on the notebook data.

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

    Selecting a prompt for code generation

    (Optional>If you selected Review prompt, select which cells to send for analysis in the Review of generated prompt window.

  3. After the code suggestion is submitted, you have the following options:

    • Accept and run (for code cells only): to add the code to the cell and run it as-is

    • Accept: to add the code to the cell and continue working on it

    • Copy to clipboard: to copy the code suggestion to clipboard

    Code suggestion in diff view

Set a custom notebook objective

Specify a notebook objective that the AI assistant will use to generate code suggestions for your next cells. This objective will persist through the notebook, which makes sure your further codes suggestions are based on the same end goal.

  1. Click the Notebook objective icon in the right part of the Autopilot tool. This will open the Notebook objective dialog.

  2. Provide an objective in the text box in the Notebook objective dialog and click the Apply button.

After specifying the custom objective, you can use the Autopilot as described here.

Modify prompts for Autopilot

The steps below show how you can modify your prompts sent to Autopilot to have code suggestions regenerated.

  1. To clear or edit the custom objective, click the Notebook objective icon and do either of the following in the dilog:

    • To edit the objective, provide a new text and click Apply button.

    • To clear the objective, click Clear the custom objective.

  2. To get a new choice of Autopilot-generated prompts after specifying or editing the custom objective, click the Regenerate icon in the right part oof the tool.

  3. To use one of the earlier prompts submitted earlier, click the Prompt history icon in the right part of the Autopilot tool and select the prompt from the expanded list.

Use your own prompts for code suggestions

You can use Autopilot for code suggestions in the same way you use the in-cell Ask AI tool. Provide a prompt in the text field in the tool and proceed as described here.

    Last modified: 02 May 2024