How It Works
The system operates in three stages: indexing your semantic model metadata, retrieving relevant entities when queries come in, and generating suggested Malloy queries to address the question.Indexing
When you publish a semantic model to Credible, the platform indexes the metadata encoded in your model to make it searchable. Documentation tags (#(doc)) capture human-readable definitions for each field. These descriptions are indexed and searchable with natural language, allowing AI agents to find data entities based on meaning rather than exact field names.
#(index_values)) tells the platform to extract and index distinct values from specific columns. This enables discovery when users search for data values rather than field names.
program_name but contains values like “World Cup Finals” or “MLS Championship”. When a user asks about “soccer games”, the system needs to search the actual values—not just the column name—to find relevant content. Value indexing makes this possible.
Retrieval
When a natural language query comes in, the retrieval API finds semantic matches across your indexed models. This is powered by state-of-the-art embedding models—the same technology that powers LLMs—which map related natural language concepts together. This means an AI agent can semantically search for “soccer games” and correctly retrieve both “World Cup Finals” (a program title) and “Sports” (a genre) without exact string matching or prior knowledge of the schema.Query Generation
The retrieval system doesn’t just find relevant data—it also generates a Malloy query intended to address the scope of the natural language request. This gives agents a starting point for analysis that they can refine based on conversation context.Why This Approach?
This retrieval-first design mirrors how analysts actually approach business questions. When a business user comes to a database, they rarely know the exact query or even what data is available. They might have:- A goal (“understand customer churn”)
- A topic (“Q4 sales performance”)
- A question (“why did revenue drop?”)
- A hunch (“I think product returns are up”)
- Understand the question - The system interprets what the user is trying to learn
- Discover relevant data - Semantic search finds data entities that might help, even with imprecise terminology
- Suggest analysis approaches - The agent receives not just data, but potential ways to analyze it
- Iterate naturally - The agent can refine queries, ask follow-ups, or explore related dimensions
Optimizing Your Models for Retrieval
To get the best results from the Intelligent Context Engine:- Add
#(doc)tags to dimensions and measures with clear, business-friendly descriptions - Use
#(index_values)on high-cardinality dimensions where users might search by value (product names, customer names, titles, etc.) - Write descriptions in natural language - describe what the field means to a business user, not just its technical definition