|
| 1 | +--- |
| 2 | +title: "Conversational Agent App" |
| 3 | +language: python |
| 4 | +author: "Vivian Xie" |
| 5 | +date: 2025-06-09 |
| 6 | +--- |
| 7 | + |
| 8 | +# Conversational Agent App |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +This repository demonstrates how to integrate Databricks' AI/BI Genie Conversation APIs into custom Databricks Apps applications, allowing users to interact with their structured data using natural language. |
| 16 | + |
| 17 | +You can also click the Generate insights button and generate deep analysis and trends of your data. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +## Overview |
| 24 | + |
| 25 | +This app is a Dash application featuring a chat interface powered by Databricks Genie Conversation APIs, built specifically to run as a Databricks App. This integration showcases how to leverage Databricks' platform capabilities to create interactive data applications with minimal infrastructure overhead. |
| 26 | + |
| 27 | +The Databricks Genie Conversation APIs (in Public Preview) enable you to embed AI/BI Genie capabilities into any application, allowing users to: |
| 28 | +- Ask questions about their data in natural language |
| 29 | +- Get SQL-powered insights without writing code |
| 30 | +- Follow up with contextual questions in a conversation thread |
| 31 | + |
| 32 | +## Key Features |
| 33 | + |
| 34 | +- **Powered by Databricks Apps**: Deploy and run directly from your Databricks workspace with built-in security and scaling |
| 35 | +- **Zero Infrastructure Management**: Leverage Databricks Apps to handle hosting, scaling, and security |
| 36 | +- **Workspace Integration**: Access your data assets and models directly from your Databricks workspace |
| 37 | +- **Natural Language Data Queries**: Ask questions about your data in plain English |
| 38 | +- **Stateful Conversations**: Maintain context for follow-up questions |
| 39 | + |
| 40 | +## Example Use Case |
| 41 | + |
| 42 | +This app shows how to create a simple interface that connects to the Genie API, allowing users to: |
| 43 | +1. Start a conversation with a question about their supply chain data |
| 44 | +2. View generated SQL and results |
| 45 | +3. Ask follow-up questions that maintain context |
| 46 | + |
| 47 | +## Deploying to Databricks apps |
| 48 | + |
| 49 | +The app can be installed through Databricks Marketplace. If you prefer to clone and deploy it manually, please refer to these instructions: |
| 50 | + |
| 51 | +1. Clone the repository to your Databricks workspace using [Git Folder](https://docs.databricks.com/aws/en/repos/repos-setup): |
| 52 | + - Navigate to the **Workspace** section in the sidebar. |
| 53 | + - Click on the 'Create' button, select the 'Git Folder' option and follow the prompts to clone the repository. |
| 54 | + |
| 55 | +2. Create an app with a serving endpoint resource. |
| 56 | + - Navigate to the **Compute** section in the sidebar. |
| 57 | + - Go to the Apps tab and click the **Create app** button. Fill in the necessary fields and click **Next: Configuration** |
| 58 | + - To reuse an existing app, click the link to your app in the **Name** column to go to the detail page of the app, then click **Edit** |
| 59 | + - In the App resources section, click **+ Add resource** and select **Serving endpoint**. Choose a chat endpoint, grant **CAN_QUERY** permission and name it 'serving_endpoint'. |
| 60 | + |
| 61 | +For detailed instructions on configuring resources, refer to the [official Databricks documentation](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/resources#configure-resources-for-your-app). |
| 62 | + |
| 63 | +3. Deploy the app using the Databricks Apps interface: |
| 64 | + - Go to the detail page of the app. |
| 65 | + - Click **Deploy** and select the folder 'conversational-agent-app' from the created Git folder. |
| 66 | + - Click **Select**, then **Deploy**. |
| 67 | + - Review the configuration and click **Deploy**. |
| 68 | + |
| 69 | +For more details, refer to the [official Databricks documentation](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/deploy). |
| 70 | + |
| 71 | +## Troubleshooting |
| 72 | + |
| 73 | +For troubleshooting, navigate to the Monitoring page of the selected genie space and check if the query has been sent successfully to the genie room via the API. |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +Click open the query and check if there is any error or any permission issues. |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +## Resources |
| 82 | + |
| 83 | +- [Databricks Genie Documentation](https://docs.databricks.com/aws/en/genie) |
| 84 | +- [Conversation APIs Documentation](https://docs.databricks.com/api/workspace/genie) |
| 85 | +- [Databricks Apps Documentation](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/) |
0 commit comments