6.6 C
New York
Wednesday, March 12, 2025

Asserting Public Preview of AI/BI Genie Dialog APIs


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, obtainable 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 possibly can programmatically submit pure language prompts and obtain knowledge insights simply as you’ll within the Genie consumer interface. The API is stateful, permitting Genie to retain context as you ask follow-up questions inside a dialog thread.

On this weblog, we assessment the important thing endpoints obtainable 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 Follow

Let’s stroll by means 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 advocate beginning with our product documentation to arrange your Genie area after which following these greatest 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 group to make use of this area to ask questions and discover insights—however as a substitute of accessing it by means of the Genie UI, you need them to take action from inside an exterior utility.

To start, suppose you need your advertising and marketing group to ask an easy query: “Which prospects did we contact through 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, similar to within the Genie Area UI. Be aware that the request should embrace your host element, Genie Area ID, and an entry token for authentication. You’ll find the space_id within the Genie Area 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
HOST= <WORKSPACE_INSTANCE_NAME>
Authorization: <your_authentication_token>
{
    “content material”: “Which prospects did we attain out to through e-mail yesterday?”,
}

If the assertion is submitted accurately, 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 through e-mail yesterday?”,
    “user_id”: 12345
  },
   “message_id”: “e1ef34712a29169db030324fd0e1df5f”,
  “message”: {
    “attachments”: null,
    “content material”: “Which prospects did we attain out to through 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 verify the message’s technology 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= <WORKSPACE_INSTANCE_NAME>
Authorization: Bearer <your_authentication_token>

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 through 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= <WORKSPACE_INSTANCE_NAME>
Authorization: Bearer <your_authentication_token>

After all, you can too difficulty follow-up prompts to your dialog threads. For instance, for example the advertising and marketing group needs 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 prevailing dialog thread as follows:

POST /api/2.0/genie/areas/{space_id}/conversations/{conversation_id}/messages
HOST= <WORKSPACE_INSTANCE_NAME>
Authorization: <your_authentication_token> 
{
    “content material”: “Which of those prospects opened and forwarded the e-mail?”,
}

Do you have to need to refresh knowledge from earlier prompts, the API additionally means that you can re-execute SQL queries that had been beforehand generated. For extra particulars on the API endpoints, please seek advice from the product documentation.

Dialog APIs Finest Practices

To make sure one of the best efficiency, we advocate the next API greatest 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 most common queries
  • If no response is obtained inside 2 minutes, implement exponential backoff to enhance reliability
  • Make sure you create new dialog threads for every consumer session; reusing the identical dialog thread for a number of periods can negatively impression 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)
  • Electronic mail adverts (structured knowledge saved in a Unity Catalog desk)
  • Consumer textual content opinions (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 possibly can outline the next Langgraph agent framework:

The agent framework graph would appear to be the next:

Agent Framework

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 will probably be triggered. MLFlow traces present the framework’s steps:

MLFlow Trace UI

The agent framework additionally allows brokers to share solutions as context for one another. This permits customers to get knowledge solutions that pull from a number of sources seamlessly. For instance, the advertising and marketing supervisor could need 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:

Agent Framework

With this strategy, your enterprise customers can now reply knowledge questions that span a number of matters/knowledge varieties and construct on one another.

Instance: Easy methods to Combine Genie with Microsoft Groups

In the course of the Dialog API’s Non-public Preview interval, Microsoft Groups was one of the well-liked 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’ll need to take the next steps:

  1. Create a brand new Azure Bot – together with useful resource teams and app service plans.
  2. Add the required surroundings variables and dependencies to your bot. 
  3. Implement the dialog logic utilizing Dialog APIs (beginning dialog, retrieving outcomes, asking follow-up questions, and so forth.).
  4. Import the Genie Azure Bot right into a Groups Channel.

For detailed examples of precisely learn how to configure the Dialog APIs for Microsoft Groups please seek advice from the next articles:

The instance beneath highlights a real-world utility from one in every of our prospects who used the Dialog APIs throughout the Non-public Preview interval. Casas Bahia, a number one retailer in Brazil, serves thousands and 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 surroundings. To be taught extra about their use case, learn the Casas Bahia buyer story.

Conversion APIs

“Having Genie built-in with Groups has been an enormous step ahead for knowledge democratization. It makes knowledge insights accessible to everybody, irrespective 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 possibly can empower enterprise customers to speak to their knowledge from any floor. To get began, please seek advice from the product documentation.

We’re excited to see how you’ll use the Genie Dialog APIs and encourage you to begin creating Genie areas straight away. There’s a ton of content material obtainable to get you going– you possibly can go to the AI/BI and Genie internet pages, take a look at our in depth library of product demos, and make sure you learn by means of the total AI/BI Genie documentation.

The Databricks group is all the time trying to enhance the AI/BI Genie expertise, and would love to listen to your suggestions!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles