# Azure OpenAI Service integration
URL: https://docs.datarobot.com/en/docs/classic-ui/dr-notebooks/code-nb/dr-openai-nb.html

> Use Azure's OpenAI assistant to generate code in DataRobot Notebooks.

# Azure OpenAI Service integration

> [!NOTE] 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.
> 
> Feature flag: 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

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

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.

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

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!.

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.

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

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

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

---
