Share via


Use Genie Code

Genie Code is a context-aware AI assistant that helps you with data work in Databricks notebooks, SQL editor, jobs, AI/BI dashboards, file editor, and more. It is capable of generating, optimzing, explaining, and fixing code and queries. Use the Genie Code chat to ask for help and use Agent mode to let Genie Code autonomously work on complex multi-step tasks.

Note

Genie Code defaults to using Databricks-hosted AI models if you disable Partner-powered AI features.

To learn how Genie Code helps with code, see Get coding help from Genie Code.

Tour of Genie Code pane

This section describes the default experience of Genie Code pane.

To open Genie Code pane, click DB Assistant icon. on the upper-right corner of the page.

The Assistant pane with a slash prompt.

Type questions or slash commands in the text box at the bottom of Genie Code pane and press Enter or click Send icon. at the right of the text box. Genie Code displays its answer.

If you prompt Genie Code to help with code, it leads you through running, accepting, or rejecting the code changes it proposes.

Genie Code pane controls and settings

Genie Code pane header has controls and settings.

  • Click Plus icon. start a new thread.

  • Click Gear icon. to open Genie Code settings. From here, you can add custom user and workspace instructions.

  • Click Kebab menu icon. to open settings for Genie Code pane.

    Assistant Chat pane menu with options.

    • Control the location of Genie Code: Choose Docked to dock Genie Code pane anywhere along the bottom. You can drag and drop the pane to move it. Choose Side to keep Genie Code pane on the right side.
    • View chat threads in History: Click History to view past chat threads. Click a chat thread to reopen it. To delete a chat thread, hover over it and click the trash icon Trash icon..
    • Change Genie Code settings. When you select Settings, the Chat pane runs the /settings assistant prompt.
  • Click Close icon. to Close Genie Code pane.

Genie Code modes

Interact with Genie Code in two different modes: Chat and Agent.

To switch between modes, use the mode selector at the bottom of Genie Code pane:

The table below summarizes the two Genie Code modes:

Mode Capabilities When to use Example prompts
Chat Answer questions to help you understand code and concepts.
Generate and run code within the chat.
  • Explaining code or errors
  • Learning about Databricks concepts
  • Simple code generation
  • "What does this function do?"
  • "What is Unity Catalog?"
  • "Write a unit test for this function"
Agent Automate multi-step workflows, plan a solution, retrieve relevant assets, run code, use cell outputs to improve results, fix errors automatically, and more.
  • Exploratory data analysis
  • Notebook organization
  • Dashboard generation
  • Pipeline creation
  • "Perform EDA on @example_table and summarize the insights."
  • "Give each notebook cell a relevant name."
  • "Analyze @bakehouse data and create a dashboard to show insights."
  • "Create a pipeline to update @example_table daily."

While Genie Code is available throughout Databricks, Agent mode is only available in some product surfaces. See Genie Code capabilities.

Get help with code

Get help with code from Genie Code directly in your notebooks. Genie Code offers:

Users should always review any code generated by Genie Code before running it because it can sometimes make mistakes.

For more information on how Genie Code can help with code, see Get coding help from Genie Code.

Code optimized for the Azure Databricks environment

Code generated by the Genie Code is intended to run in a Databricks compute environment. It is optimized to create code in Databricks-supported programming languages, frameworks, and dialects. It is not intended to be a general-purpose programming assistant.

Genie Code often uses information from Databricks resources, such as the Databricks documentation website or Knowledge Base, to better answer user queries. It performs best when the user question is related to questions that can be answered with knowledge from Databricks documentation, Unity Catalog, and user code in the Workspace.

Get answers sourced from documentation

Genie Code searches Databricks documentation to answer your questions. When it references documentation, you see a Searched documentation step in the response. You can ask Genie Code to cite its sources, and it provides links to relevant documentation pages.

A Genie Code response showing a documentation-sourced answer.

Give feedback on Genie Code answers

Let us know whether Genie Code answers are useful or not:

  1. Hover just below Genie Code answer.
  2. Click the Useful Thumb up icon. or Not useful Thumb down icon. button.

Additional information