Adding Structured Data with SQL Narratives
Once you have created a Knowledge Store, the next step is to add data to it so assistants can use it.
Understanding SQL Narratives
A SQL Narrative tracks a table available in the local Data Studio database. If the data you want to use is stored in an external source, first load it into Data Studio, for example by using a recipe.
When rows in that table are added or changed:
-
The Narrative runs the configured SQL query against the updated row.
-
The results of that query are inserted into the Narrative Template, which converts the row into readable text.
-
That text is processed and stored in the Knowledge Store so it can be searched when you ask questions to an assistant.
Creating an SQL Narrative
Before creating an SQL Narrative, create an SQL Knowledge Store and ensure that the table you want to use is available in the local Data Studio database.
-
Click the Management icon in the application menu.
-
Under AI Assistants, click Knowledge Stores.
-
Click the SQL tab.
-
In the row of the Knowledge Store you want to add a Narrative to, click the menu
icon. -
Click + New Narrative.
-
Provide the following information:
Narrative NameRequired—Unique identifier for the Narrative.
DescriptionOptional—A description of the Narrative. Unlike Knowledge Store descriptions, a Narrative description is purely for your reference.
Max Failed RecordsRequired—Maximum number of records that can fail processing before the Narrative enters an error state.
Table NameRequired—Name of the structured SQL table whose data the Narrative will add to the Knowledge Store.
SQL QueryRequired—SQL query used to get information to populate the Narrative Template.
Narrative TemplateRequired—A text template that references fields returned by the SQL query. For each record, the returned values are inserted into the template, and the resulting text is converted into a searchable format
-
Click Submit.
Next, run the Narrative to process its contents.