As a part of our Week of AI brokers initiative, we’re introducing new capabilities to assist enterprises construct and govern high-quality AI brokers. To that finish, we’re excited to announce the Public Preview of the Genie Dialog APIs, accessible on AWS, Azure, and GCP. With this API suite, your customers can now leverage AI/BI Genie to self-serve knowledge insights utilizing pure language from any floor, together with Databricks Apps, Slack, Groups, Sharepoint, custom-built functions and extra. Moreover, the Dialog APIs allow you to embed AI/BI Genie in any AI agent, with or with out Agent Framework.
Utilizing the Genie Dialog API suite, you may programmatically submit pure language prompts and obtain knowledge insights simply as you’ll within the Genie person interface. The API is stateful, permitting Genie to retain context as you ask follow-up questions inside a dialog thread.
On this weblog, we evaluate the important thing endpoints accessible within the Public Preview, discover Genie’s integration with Mosaic AI Agent Framework, and spotlight an instance of embedding Genie right into a Microsoft Groups channel.
Genie Dialog APIs in Observe
Let’s stroll by way of a sensible instance to know how the Genie Dialog APIs work. The very first thing to notice is that the Dialog APIs have to work together with a Genie area that has already been created. We suggest beginning with our product documentation to arrange your Genie area after which following these finest practices to configure it optimally.
Think about you’ve already created, configured, and shared a Genie area designed to reply questions on your advertising and marketing knowledge. Now, you need your advertising and marketing staff to make use of this area to ask questions and discover insights—however as a substitute of accessing it by way of the Genie UI, you need them to take action from inside an exterior utility.
To start, suppose you need your advertising and marketing staff to ask a simple query: “Which prospects did we contact by way of e-mail yesterday?”. To ask this query utilizing the Genie Dialog APIs we might want to ship a POST request to the next endpoint:
/api/2.0/genie/areas/{space_id}/start-conversation
This endpoint begins a brand new dialog thread, utilizing your query because the preliminary immediate, identical to within the Genie House UI. Be aware that the request should embrace your host part, Genie House ID, and an entry token for authentication. You could find the space_id within the Genie House URL, as proven beneath:
https://instance.databricks.com/genie/rooms/12ab345cd6789000ef6a2fb844ba2d31
The next is an instance of the proper POST request required:
POST /api/2.0/genie/areas/{space_id}/start-conversation |
If the assertion is submitted appropriately, the API will return the created dialog and message in response to the POST request, as proven within the following instance:
{ “conversation_id”: “6a64adad2e664ee58de08488f986af3e”, “dialog”: { “created_timestamp”: 1719769718, “conversation_id”: “6a64adad2e664ee58de08488f986af3e”, “last_updated_timestamp”: 1719769718, “space_id”: “3c409c00b54a44c79f79da06b82460e2”, “title”: “Which prospects did we attain out to by way of e-mail yesterday?”, “user_id”: 12345 }, “message_id”: “e1ef34712a29169db030324fd0e1df5f”, “message”: { “attachments”: null, “content material”: “Which prospects did we attain out to by way of e-mail yesterday?”, “conversation_id”: “6a64adad2e664ee58de08488f986af3e”, “created_timestamp”: 1719769718, “error”: null, “message_id”: “e1ef34712a29169db030324fd0e1df5f”, “last_updated_timestamp”: 1719769718, “query_result”: null, “space_id”: “3c409c00b54a44c79f79da06b82460e2”, “standing”: “IN_PROGRESS”, “user_id”: 12345 } } |
Utilizing the conversation_id and message_id, now you can ballot to examine the message’s era standing and retrieve the generated related SQL assertion and question description as follows:
GET /api/2.0/genie/areas/{space_id}/conversations/{conversation_id}/messages/{message_id} HOST= Authorization: Bearer |
The next is an instance of the response:
{ “attachments”: [{ “query”: { “description”: “Query description in a human readable format”, “last_updated_timestamp”: 1719769718, “query”: “SELECT * FROM customers WHERE date >= CURRENT_DATE() – INTERVAL 1 DAY”, “title”: “Query title”, “statement_id”: “9d8836fc1bdb4729a27fcc07614b52c4”, “query_result_metadata”: { “row_count”: 10 }, } ‘attachment_id’: ’01efddddeb2510b6a4c125d77ce176be’ }], “content material”: “Which prospects did we attain out to by way of e-mail yesterday?”, “conversation_id”: “6a64adad2e664ee58de08488f986af3e”, “created_timestamp”: 1719769718, “error”: null, “message_id”: “e1ef34712a29169db030324fd0e1df5f”, “last_updated_timestamp”: 1719769718, “space_id”: “3c409c00b54a44c79f79da06b82460e2”, “standing”: “EXECUTING_QUERY”, “user_id”: 12345 } |
As soon as the message standing discipline exhibits “COMPLETED”, it means the generated SQL assertion has completed executing and question outcomes are able to be retrieved. Now you can get the response as follows:
GET /api/2.0/genie/areas/{space_id}/conversations/{conversation_id}/messages/{message_id}/attachments/{attachment_id}/query-result HOST= Authorization: Bearer |
After all, you may also concern follow-up prompts on your dialog threads. For instance, for instance the advertising and marketing staff desires to ask the next query subsequent: “Which of those prospects opened and forwarded the e-mail?”
To handle this you’ll ship one other POST request with the brand new immediate to the present dialog thread as follows:
POST /api/2.0/genie/areas/{space_id}/conversations/{conversation_id}/messages HOST= Authorization: { “content material”: “Which of those prospects opened and forwarded the e-mail?”, } |
Do you have to wish to refresh knowledge from earlier prompts, the API additionally means that you can re-execute SQL queries that have been beforehand generated. For extra particulars on the API endpoints, please confer with the product documentation.
Dialog APIs Greatest Practices
To make sure the very best efficiency, we suggest the next API finest practices:
- Ballot the API each 5-10 seconds till a conclusive message standing is obtained, however restrict polling to a most of 10 minutes for commonest queries
- If no response is obtained inside 2 minutes, implement exponential backoff to enhance reliability
- Make sure you create new dialog threads for every person session; reusing the identical dialog thread for a number of classes can negatively influence Genie’s accuracy.
Integrating Genie into Mosaic AI Agent Framework
The Dialog APIs additionally seamlessly combine into your Mosaic AI Agent Framework with the databricks_langchain.genie wrapper.
Let’s say my advertising and marketing managers wanted to reply questions throughout three matters:
- Promotion occasion engagement (structured knowledge saved in a Unity Catalog view)
- E mail adverts (structured knowledge saved in a Unity Catalog desk)
- Person textual content evaluations (unstructured PDFs saved in Unity Catalog volumes)
You may construct a multi-agent framework to reply questions on each structured and unstructured knowledge. For instance, you may outline the next Langgraph agent framework:
The agent framework graph would seem like the next:
Your agent framework can now direct inquiries to their related brokers. For instance, if a advertising and marketing supervisor begins by asking “Present me attendees from my occasion on Feb 1”, the GenieEvents agent might be triggered. MLFlow traces present the framework’s steps:
The agent framework additionally allows brokers to share solutions as context for one another. This enables customers to get knowledge solutions that pull from a number of sources seamlessly. For instance, the advertising and marketing supervisor could wish to drill down and ask “Which of those attendees signed up for e-mail notifications”. The framework will use the earlier reply from GenieEvents as context for the GenieEmails agent:
With this method, your online business customers can now reply knowledge questions that span a number of matters/knowledge sorts and construct on one another.
Instance: Tips on how to Combine Genie with Microsoft Groups
Through the Dialog API’s Non-public Preview interval, Microsoft Groups was probably the most widespread productiveness instruments that prospects built-in with Genie. This integration allows customers to ask questions and get insights immediately, with out leaving the Groups UI.
To do that, you will want to take the next steps:
- Create a brand new Azure Bot – together with useful resource teams and app service plans.
- Add the mandatory setting variables and dependencies to your bot.
- Implement the dialog logic utilizing Dialog APIs (beginning dialog, retrieving outcomes, asking follow-up questions, and so forth.).
- Import the Genie Azure Bot right into a Groups Channel.
For detailed examples of precisely easy methods to configure the Dialog APIs for Microsoft Groups please confer with the next articles:
The instance beneath highlights a real-world utility from one in all our prospects who used the Dialog APIs through the Non-public Preview interval. Casas Bahia, a number one retailer in Brazil, serves hundreds of thousands of shoppers each on-line and thru its in depth community of bodily shops. By integrating the Genie Dialog APIs, Casas Bahia empowered customers throughout the group—together with C-level executives—to work together with Genie immediately inside their Microsoft Groups setting. To be taught extra about their use case, learn the Casas Bahia buyer story.
“Having Genie built-in with Groups has been an enormous step ahead for knowledge democratization. It makes knowledge insights accessible to everybody, regardless of their technical background.”
— Cezar Steinz, Information Operations Supervisor, Grupo Casas Bahia
Getting Began with Dialog APIs
With the Genie Dialog APIs now in Public Preview, you may empower enterprise customers to speak to their knowledge from any floor. To get began, please confer with the product documentation.
We’re excited to see how you’ll use the Genie Dialog APIs and encourage you to start out creating Genie areas immediately. There’s a ton of content material accessible to get you going– you may go to the AI/BI and Genie internet pages, take a look at our in depth library of product demos, and make sure to learn by way of the complete AI/BI Genie documentation.
The Databricks staff is at all times seeking to enhance the AI/BI Genie expertise, and would love to listen to your suggestions!