Table Lookup Block
This chapter will explain the role of table lookup block and how to use it.
Basic concept
The function of the table lookup block is to allow the agent to obtain data from a table, because in actual scenarios, a lot of business data is stored in the form of tables, and the table lookup block can achieve efficient use of this structured data.
Taking this fund information table as an example, the names of each fund in the leftmost column of the table are the subject, and the fund type, risk level, and fund manager are attributes. The rest of the table is the attribute value.
There are two common ways to query tables:
When the subject and attribute are known, query the attribute value: "What is the risk level of Morgan fund?" "Who is the fund manager of Ultra fund?"
When the "attribute" and "attribute value" are known, query the "subject":
"Which funds are bond funds?"
"Which fund is a low risk fund?"
We can use the positioning function to convert the above query statements into queries on two-dimensional tables to give answers.
Positioning by
If you want to query any value in the table, you must first determine the position of the value in the table, that is, the row and column where it is located.
the agent needs to do two things to determine the "row where the value is":
- locates a column
- locates a value in this column
For example, in order to query "What is the risk level of Morgan Fund?", the agent can: 1. locate the column of "fund"; 2. use the value of "Morgan Fund" in the column of "fund" to determine the row where the query result is located.
the agent needs to do one more thing to determine the "column where the value is":
- locates another column
For example, after the agent locates the value of "Morgan Fund" in the "fund" column, it needs to locate the "risk_level" column too. In this way, the query result can be obtained: "The risk level of the Morgan Fund is medium risk."
Lookup Setting
In summary, if we want the agent to successfully query the data in the table, we need to configure these positioning conditions in advance.
To use table lookup block in the dialogue process, we need to create the corresponding table first, and then select the corresponding table inside the block;
The drop-down list of Positioning by displays all the column names of the table. If a column name is selected, the column becomes the positioning column of the table query. If we want to query the table in an exact match, we can choose "Equal to";
The drop-down list of the positioning value shows each value of the positioning column. If we select "Morgan Fund", then the agent will query the row where "Morgan Fund" is located when querying the table.
However, to make the conversation more flexible, we can create an entity with each value of the positioning column (in this case, each fund name), then create a slot and associate it, so that the agent can extract the fund name from the user's message to fill the slot.
The drop-down list of Return to slot also shows the column name. We can select a column to help the agent locate the final table lookup position. For example, to query the type of fund, we can select the fund type column, and create a slot, and store the result of the agent query in this slot for use in the subsequent dialogue flow.
In addition, the table data contains not only text type data, but also custom content type data, such as the "fund manager" column. If you want to query the column whose field type is custom content, you can select this column under Return as answer. After the agent queries, the custom content will be directly returned to the user.
Clarify Setting
If the agent obtains multiple positioning value information in the user message, it will result in multiple query results. If the rules are not clarified, then the agent will fill the slot with multiple values and return the results in order.
However, we can configure clarification rules to optimize this process, select the column name that needs clarification under the Principal Column, and configure the clarification text, so the agent can send a clarification message to the user, allowing the user to confirm in multiple results. The clarification action can only be performed once. After successful clarification, the agent will use the value confirmed by the user to continue the table lookup process and return the unique table lookup result.
Of course, there may be cases where the user fails to clarify successfully. In this case, the agent will fill in the slot with multiple values, not return an answer, and consider the table lookup to be successful and continue the dialogue process.
Routes
The table lookup block takes whether the data in the table is successfully queried as the basis for entering different branch routes.