Understanding Databrick’s New AI Assistant

What do I need to know about Databricks Assistant?

The Databricks Assistant revolutionizes the way we interact with and analyze data by conversing with us in plain English. From writing code to troubleshooting errors and optimizing performance, it serves as a reliable companion throughout our data analysis journey. With its intuitive interface and helpful guidance, it feels like having a supportive friend right by our side, making data tasks more accessible and efficient. Say goodbye to language barriers and hello to seamless data exploration with the Databricks Assistant!

What is Databricks Assistant?

Databricks Assistant acts as a collaborative AI partner, boosting your productivity while you work on notebooks, queries, and files. It speeds up your workflow by rapidly providing solutions like generating, finishing, clarifying, and correcting code.

How to Enable Databricks Assistant?

Databricks Assistant is enabled by default.

To enable or disable all workspaces in an account for Databricks Assistant, follow these instructions:

  1. Sign in as the account administrator and navigate to the account console.
  2. Locate the “Settings” option and give it a click.
  3. Head over to the “Feature enablement” tab.
  4. In the section titled “Azure AI services-powered AI assistive features,” we can opt to either activate (Enabled) or deactivate (Disabled) the Databricks Assistant. Don’t forget to hit “Save” afterward.
  5. Save your changes once again, and we’re all set!

How to utilize Databricks Assistant for Code Assistance:

To open up Databricks Assistant, simply click on the Assistant icon located in the left sidebar of our notebook, file editor, SQL Editor, or the Lakeview Data tab.

The Assistant panel opens on the left side of the screen.

How to use Databricks Assistant in a notebook cell?

To use Databricks Assistant directly in a code cell, simply press Cmd + i on MacOS or Ctrl + i on Windows. This action will prompt a text box to appear within the cell. From there, we can input our question or comment in English. Once we’re done, hit Enter (not Shift + Enter, which typically runs a cell) to trigger the Assistant to generate a response for us.

Additionally, we have the option to type /to reveal a list of frequently used commands. This includes options like /explain, which provides an explanation of the code in the cell, /fix, which offers suggestions for fixing any errors in the code, and /doc, which provides documentation comments on our code.

In addition to utilizing /fixor /doc, the assistant shows suggested modifications within a differential window. From there, we have the option to either “Accept” the proposed changes or “Reject” them to retain the original code. It’s worth noting that if we opt to accept the proposed code, it won’t automatically execute. This allows us to review the alterations before running the code. If the generated code doesn’t align with our requirements, we can refine our comment with additional details and try again. Here are some Tips section for using Databricks Assistant.

For code suggestion and completion, we might find better performance using the Assistant pane compared to within a notebook cell. To close the Assistant within a notebook cell, simply click on the upper-right corner of the cell. Alternatively, if we Accept or Reject the generated code, the Assistant will close automatically.

Assistant pane

To open the Assistant pane, click in the left sidebar.

  • Access the Assistant pane from the left sidebar.
  • Type questions in the text box and press Enter for responses.
  • Easily regenerate queries or close the pane as needed.
Assistant pane UI

Automatically format code:

To format our code to adhere to best practices, type “prettify” into the assistant text box or assistant pane.

Debug code:

To fix code using Databricks Assistant, we can either ask a question in the Assistant pane or click the Diagnose Error button that shows up when there’s an error in our code.

To fix this error in the code, click on Fix my code in the Assistant pane and this will fix and it will help us to diagnose the error in the code.

Once we click on the Fix my code it will find out our error and the name ‘x’ was not defined therefore it will correct the code, later the code should run without any Error.

Hence it will debug the error in our code and will give us the updated one.

Conclusion:

Databricks Assistant is a big deal for people who work with data. It makes things much easier and faster in the Databricks system. It uses smart technology like AI and language understanding to help users work better and solve problems faster. With its many helpful features and easy-to-use design, Databricks Assistant is set to become a must-have tool for all kinds of data analysis tasks, no matter how big or small they are.

Author: Nihalataskeen Inayathulla

Leave a Reply

Your email address will not be published. Required fields are marked *