AI and Honeydew

An AI or a large language model (LLM) can be capable of translating business questions like “What is our monthly profit in Seattle?” into data and insights for business users.

As a semantic layer, Honeydew provides AI with the context of your data model.

Using semantics as context, users can escape common pitfalls of applying LLMs to data - such as inconsistent or inaccurate results.

The core advantages of combining AI and a semantic layer:

  1. Consistency: Honeydew provides AI with well-defined metrics and business entities. By leveraging a definition managed by Honeydew, AI can’t hallucinate a metric definition or create wrong SQL.
  2. Time to value: Honeydew can operate on top of a complex data schema, with multiple fact tables and snowflake schemas. By providing an abstraction that AI understands, Honeydew enables to run AI directly on your data without transformations.
  3. Complex Metrics: Many business metrics can be complex, with derivative calculations, time intelligence, dynamic levels of details, and multi-step calculations. As Honeydew manages the calculation of the metric, AI can use those metrics without making mistakes.
  4. Combine BI and AI: Honeydew provides BI tools with the same semantics as it provides AI. That allows to maintain consistency of results between any BI dashboards and an AI chatbot response.

Honeydew can integrate with your own LLM and prompt (such as Meta LLama or OpenAI GPT-4o), or with Snowflake Cortex.

Our LLM integration requires the installation of Honeydew Snowflake Native Application.

Text to SQL API

The Honeydew Text-to-SQL API is part of the Honeydew Native Application.

Honeydew integrates with Snowflake Cortex LLM for providing a Text to SQL capability using a semantic layer.

All data processing, including any LLM or AI steps, is fully contained within your Snowflake account.

Honeydew Text to SQL API uses a Cortex LLM running in your Snowflake.

The API accepts a user question, as well as a history of previous conversations, and returns:

  1. Correct SQL to run to get data, if the question can be answered by the semantic schema.
  2. Well-defined business terms used to answer the question, such as applicable metrics.
  3. Textual response providing additional context, if required.

Under the hood, the Honeydew API:

  1. Uses an LLM tuned to operate on the Honeydew semantic layer.
  2. Leverages the LLM to generate a semantic query that operates in the context of a well-defined domain in your schema.
  3. Use the Honeydew semantic compiler to translate that into correct SQL.

Sample Application

A sample Streamlit application can be found here.

Integration

The Honeydew Text-to-SQL API can be embedded into any user interface that has a connection to Snowflake.

Common user interfaces include Slack or Teams bots as well as embedded BI applications.

Please contact support@honeydew.ai for Text-to-SQL API integrations with tools such as Slack or Teams, or for homegrown and embedded applications.

Best Practices

There are many best practices around teaching AI to understand your business. Our solution team can help.

Some common core practices:

  1. Create a domain that only includes approved metrics and attributes for AI.
  2. Use Honeydew metadata such as metric and attribute descriptions to teach AI about meaning.
  3. Include in descriptions common synonyms for metrics, or build multiple derived metrics with appropriate names that all reference the same one.
  4. Avoid having multiple similarly named attributes and metrics without providing a clear explanation what each means.
  5. Provide to AI in the domain a time spine and do not provide any other date fields. Honeydew will take care of correctly connecting the dates to specific metrics.
  6. Use time metrics to control how metrics relate to time correctly.
  7. Do not provide foreign keys, or any other internal attributes to AI. Only provide metrics and attributes a business user will directly reference. When building the query, Honeydew will automatically use its lineage to add required dependencies, even if they are not part of the domain.

Train your own AI on Honeydew

It is possible to train an LLM to use the Honeydew API directly.

The Honeydew Text-to-SQL API is a simple way to intergrate LLM without any training.

LLMs such as Mistral, Meta Llama and OpenAI GPT-4 can be used with Honeydew.

An application that integrates an LLM with Honeydew is typically:

  1. Capable of accepting a user input (a question) and showing response (data)
  2. Uses Honeydew API calls to get an approved semantic schema (typically, a Honeydew domain) that has curated metrics and entities.
  3. Uses a trained LLM that can accept as input the schema and the user question and generate a Honeydew API call such as:
select SEMANTIC_LAYER_ENTERPRISE_EDITION.API.GET_SQL_FOR_FIELDS(
        -- workspace / branch
        $WORKSPACE, $BRANCH,
        -- AI-specific domain
        'curated_domain_for_ai',
        -- dimensions chosen by AI
        ['date.month'],
        -- metrics chosen by AI
        ['order_detail.revenue'],
        -- filters built by AI
        ['location.city = ''Seattle''']
    );
  1. Runs the SQL statement received from Honeydew in Snowflake to get data that answers the user question.

Please contact support@honeydew.ai for help trainging and supporting generic LLM models.