Page cover image

Bot Customization

Nudging your bot to perform better

Custom Bot Context

Depending on your company and the use cases for the bot, you can tune your bot to respond in certain ways by leveraging the Global Context. Unlike Table Readme's and Documentation that are only added to context when queried, Bot Context is always used every time to answer questions.

To add Bot context, click the customize button and add tips and tricks for how to query your data, just like you would tell a human analyst. Checkout this case study to learn more about. how one of our customers uses context to tune their bot.

Analyses as Context

Every time you Save an Analysis, that adds the Analysis' SQL query and Chart to the AI's context, so it now knows what you mean when you refer to something such as Customer LTV.

Here is an example where the AI makes an assumption on Customer LTV and how to calculate it. After saving this, the AI will know to calculate Customer LTV in a similar way every time.

Table Documentation

Add notes in the Table's Readme to provide hints to the AI when querying tables. One common reason to add context to a Readme is when categorical data exists in a column. For example, here we've provided hints for both the external_source column and the location column enabling the AI to query without issue.

Generic Documentation

Docs can be added by clicking on them in the bottom left and adding a new one. In this screenshot below, I've added a new metrics definition "Trailing Annual Run Rate" and queried it below. If you ask for the run rate on a particular channel, location, or for the whole company, this definition will be applied when the Bot answers your question with SQL.

When you write a document, the AI will chunk it by using # separators. So if you wanted you could include all your metrics in a single document and separate them by #'s so that you're not always pulling the entire set of documentation into context.

Use cases:

  1. Metrics definitions

  2. Querying knowledge base information (eg API docs, policies, etc)

  3. General Q&A

Upload DBT project (beta)

If you have an existing dbt project that you wish to query with natural language, you can also add this project as custom context.

This feature is in beta, and requires the Patterns team to run an internal script that will upload your dbt core project, including all your data documentation and models as Table documentation and SQL files as Generic documentation. We are exploring other integration paths and look forward to working with you here! Please contact chris@patterns.app if interested.

Last updated