Best practices for querying Teneo Inquire

The conversational data that is generated by the users of your bot is a valuable source of information for improvement, but can also provide you with valuable business insights. Teneo Query Language (TQL) allows you to analyze the conversational logs generated by your published bot. It can be looked at as a similar tool to the SQL language, where you create queries to examine, analyze, filter, and understand large amounts of data at different levels.

Just like when developing SQL queries against a database, there are several steps you can take to both see faster results and avoid overly large results when working on your Teneo Query Language (TQL) queries

In this knowledge article, we will go through some best practices when working with Teneo Query language when querying Teneo Inquire.

Use the Data Hierarchy

The conversation logs, together with its data is logged under a data hierarchy that has the following hierarchy:

  • Property - The basic queryable elements in the data: can be located in sessions, transactions, or events

  • Session - A collection of transactions documenting a user’s interactions with the system

  • Transaction - A collection of events starting with a request (user input) and ending with the bot’s response

  • Event - A record of the entire path through the solution leading to a response

While some properties have their unique data. Some data are actually shared between different levels. In those cases, information that can be retrieved on a higher level in the Data Hierarchy should do that.

For example:

Returns the same as the following query:

Second query to show transaction time

Where the only difference is the time property is being captured on a session-level, instead of on a transaction level.

You can read about the computational costs of TQL and good practices here: TQL Syntax Overview | Teneo Developers

Use sample data while developing

When developing datasets with a large number of data, it is a good idea to restrict the amount of data pulled by queries. This can be done by simply adding ‘SAMPLE’ at the beginning of the query. The ‘SAMPLE’ meta parameter, integer argument specifying how many sessions to randomly sample and return results from.

For example:

Teneo Query Language, sample data when building

while,

User does not use Sample to write queries

Using ‘SAMPLE’ will give you immediate results and make the development stage run much smoother.

We recommend using between 10 to 100 samples while developing your query.`

More on samples can be found here: Document

Define the event type

Each transaction consists of a collection of events that records everything that happened in the solution from the beginning to the end of the transaction. This is the path the user takes from start until they receive a response. These are referred to as events when writing queries in Teneo Query Language.

There are three different event types in Teneo Query Language,

  • Request - the call to the bot with the user input and all additional parameters

  • Path - the path the user input takes through the solution until a response is received.

  • Response - the bot’s response along with Output Parameters returned to the user

When writing complex queries on event-level it is recommended to define which type of event you are interested in. This way the query will take less time to load and avoid any large spikes in your servers.

For example:

User defines event type when writing Teneo Query Language

while,

User does not define event type in TQL query

See also

Please look at the following chapters if you are more interested in using Teneo Query Language to analyze your bot.

1 Like