Adding a Statement to the Semantic Context
The Semantic Context in Waii enhances query generation by providing relevant contextual information. This document explains how to add a statement to the Semantic Context.
Accessing the Semantic Context
- Open the SQL Builder.
- Find the 'Semantic Context' link in the header, next to the hamburger menu.
- Click on it to open a dialog showing all existing semantic context.
- At the bottom of the dialog, click the 'Add New' button.
Types of Semantic Statements
Simple Statements
Simple statements are always used when the associated database object is referenced. Examples include:
- Database Instructions: e.g., "This column is deprecated, don't use."
- Usage Information: e.g., "Revenue's preferred sort order is descending; typical aggregates are sum."
RAG Statements
RAG (Relevance-Aware Guidance) statements are filtered by relevance to the current questions or instructions. Examples include:
- Additional Documentation: e.g., Documentation of the ingest process
- Auxiliary Information: e.g., Annual report
Specifying a Semantic Statement
To add a semantic statement, provide the following information:
-
Statement
- Description: The natural language statement giving context.
- Example: "This column is deprecated, don't use."
-
Scope
- Description: The database, schema, or table that this statement refers to.
- Example: "sales_db.sales_schema.sales_table"
-
Labels (Optional)
- Description: Labels to categorize and manage statements.
- Example: "deprecated, usage"
-
Always Included
- Description: Indicates whether it's a Simple (true) or RAG (false) statement.
- Example:
true
for Simple,false
for RAG.
-
Lookup Summaries
- Description: Keys and important information from the document that need to be indexed separately.
- Example: ID or reference number for documents loaded
-
Summarization Prompt (Optional)
- Description: An optional prompt to summarize the statement. Useful for lengthy documents to reduce at runtime.
- Example: "Summarize the abstract of the document only."
Example
Here is an example of adding a semantic statement:
- Statement: "This column is deprecated, don't use."
- Scope: "sales_db.sales_schema.sales_table"
- Labels: "deprecated, usage"
- Always Included:
true
API/CLI usage
To bulk load or manage semantic context it is recommended to use the CLI or API. Please refer to the respective documentation for details.