What is the Knowledge Base?
The knowledge base is a text area where you define important context about your data, business logic, and terminology. This information helps camelAI:- Maintain consistent metric definitions across all queries
- Navigate complex schemas by understanding which tables to prioritize or avoid
- Interpret ambiguous column names and relationships
- Apply proper data formatting and display preferences
- Handle time periods and date calculations correctly
- Understand locale-specific requirements (currency, language, regional formats)
Persistent vs Session-Specific Knowledge Base Entries
CamelAI supports two types of knowledge base entries, each designed for different use cases:Persistent (Stateful) Entries
Persistent entries are created through the/api/v1/knowledge-base/
API endpoint and are tied to your connection IDs. These entries:
- Persist across all iframes that use the associated connection ID
- Apply globally to all users and sessions
- Are ideal for context that applies universally across your organization
- Dataset descriptions and schema information
- Company-wide terminology and metric definitions
- Standard table relationships and joins
- Data quality notes that affect all users
Session-Specific (Stateless) Entries
Session-specific entries are provided directly in the iframe creation request via theknowledge_base_entries
parameter. These entries:
- Only apply to that specific iframe instance
- Do not persist beyond the iframe’s lifecycle
- Work alongside any persistent entries you’ve already created
- User-specific instructions (e.g., “This user prefers non-technical explanations”)
- Organization-specific context when serving multiple tenants
- Temporary overrides or custom behavior for specific sessions
- Locale preferences (e.g., “Please respond in Spanish”)
Example: Using Session-Specific Entries
When creating an iframe, you can include temporary knowledge base entries that apply only to that session:Best Practices
1. Always Include a Dataset Description
Every knowledge base should start with a clear description of what your dataset represents. This foundational context helps camelAI understand the overall purpose and structure of your data.2. Specify Standard Schemas
If your data follows a well-known schema or is a replica of a standard system, explicitly state this. camelAI can leverage its understanding of common schemas to provide better insights.Examples of standard schemas to mention:
- “This PostgreSQL database mirrors our Salesforce CRM data structure”
- “Our MySQL database follows the Shopify schema for e-commerce data”
- “This dataset implements the FHIR standard for healthcare records”
- “Our analytics tables follow the Google Analytics 4 event schema”
3. Define Company-Specific Terminology
Document any terms that have specific meanings within your organization, especially when they differ from industry standards or could be ambiguous.We recommend using multiple focused entries to improve RAG performance.
4. Clarify Complex Relationships
Help camelAI navigate joins and relationships by explaining non-obvious connections between tables.5. Specify Data Preferences
Include preferences for how data should be formatted, calculated, or displayed.6. Document Data Quality Issues
Be transparent about known data limitations or quality issues to prevent misleading analyses.Structuring Knowledge Base Entries
Use Multiple Focused Entries
Due to RAG implementation, multiple smaller, focused entries perform better than one large entry.- ✅ Good Practice
- ❌ Poor Practice