
!!! info "Availability information"
    For self-managed users, the Azure OpenAI integration is off by default. Contact your DataRobot representative or administrator for information on enabling this feature.

    Additionally, self-managed users must create their own Azure account and manage their own Azure OpenAI model deployment to configure usage with the Code Assist feature in DataRobot Notebooks.

    <b>Feature flag:</b> Enable Notebooks OpenAI Integration


You can now power your code development workflows in DataRobot Notebooks by applying OpenAI large language models for assisting with code generation. With the Azure OpenAI Service integration in DataRobot Notebooks, you can leverage state-of-the-art generative models with Azure's enterprise-grade security and compliance capabilities.



## Use the Code Assistant {: #use-the-code-assistant }

When working in a code cell in a DataRobot Notebook, you can access the Code Assistant by selecting **Assist**.

{% if section(page, "dr-notebooks") %}

![](images/nb-41.png)

{% else %}

![](images/wb-nb-41.png)

{% endif %}

Once selected, complete the prompt by telling the assistant what you want to do. The example below requests Azure OpenAI Service to write code to create a Pandas DataFrame with the Iris dataset and include comments. After completing the prompt, click **Run OpenAI**.

{% if section(page, "dr-notebooks") %}

![](images/nb-42.png)

{% else %}

![](images/wb-nb-42.png)

{% endif %}

Allow some time for the assistant to run&mdash;it then generates the result of the prompt in the cell. The prompt is maintained as the first comment in the cell.

{% if section(page, "dr-notebooks") %}

![](images/nb-43.png)

{% else %}

![](images/wb-nb-43.png)

{% endif %}

As the Code Assistant dynamically materializes the generated code in the cell's code editor, you can choose to speed up the process by clicking **Finish Up!**.

{% if section(page, "dr-notebooks") %}

![](images/nb-44.png)

{% else %}

![](images/wb-nb-44.png)

{% endif %}

You can iterate on the same code cell after generating the initial result. Click **Assist**, provide another prompt in the same code cell, and select **Run OpenAI**. For example, in the cell displayed above, you can prompt the Code Assistant to add comments in Spanish to each line.

{% if section(page, "dr-notebooks") %}

![](images/nb-45.png)

{% else %}

![](images/wb-nb-45.png)

{% endif %}

The resulting cell provides comments for each line of code in Spanish.

{% if section(page, "dr-notebooks") %}

![](images/nb-46.png)

{% else %}

![](images/wb-nb-46.png)

{% endif %}

When generation completes, you can evaluate the helpfulness of the Code Assistant's generation. Select the smiley face to provide an evaluation.

{% if section(page, "dr-notebooks") %}

![](images/nb-47.png)

{% else %}

![](images/wb-nb-47.png)

{% endif %}

From the modal, select whether the generated code was helpful, not helpful, or contains inappropriate or harmful content.

![](images/nb-48.png)
