Skip to main content

Knowledge Overview

The Knowledge feature in Wren AI allows you to store and manage verified information that helps the AI generate more accurate and consistent responses. This feature is particularly useful for domain-specific context and frequently asked questions.

Types of Knowledge

1. Question-SQL Pairs

Question-SQL pairs allow you to save verified answers with matching questions and SQL statements. When a user asks a similar question in the future, Wren AI will generate SQL based on the saved SQL pairs to improve accuracy and consistency in its generation.

Use Cases:

  • Domain-specific metrics calculations
  • Complex business logic that requires precise SQL formulation
  • Frequently asked business questions with established calculation methods
  • Custom KPIs and metrics specific to your organization
  • Error-prone complex queries requiring joins across many tables

For example, if your team frequently needs to calculate "Customer Lifetime Value" with a specific methodology, you can save the question "What is our average customer lifetime value?" along with the verified SQL query that correctly calculates this metric.

2. Instructions (Coming Soon)

The Instructions feature will allow you to save:

  • Global Instructions: General guidelines that apply to all queries, helping the AI understand your data model and business rules.
  • Question-Matching Instructions: Specific guidelines that apply when certain types of questions are asked.

These instructions help the AI understand how to generate SQL for your specific data model and business context, improving accuracy and reducing the need for query refinement.

Benefits of Using Knowledge

  • Consistency: Ensures similar questions always generate responses based on your verified SQL, providing reliable and consistent results across all users
  • Accuracy: Reduces errors by using pre-verified SQL for complex queries
  • Domain Expertise: Captures your organization's specific knowledge and calculation methods

In the following sections, we'll explore how to create, manage, and leverage these knowledge types in your Wren AI implementation.