Expand description
The VlorQl facade: prompt construction, LLM planning, validation, and compilation.
A VlorQl value owns the immutable schema, dialect profile,
policy, and LLM client that drive the end-to-end query workflow.
Use VlorQl::builder to assemble a facade and then call
VlorQl::query (block on the result) or VlorQl::query_stream
(consume text chunks followed by a StreamEvent::PlanComplete).
§Re-exports
The most commonly used types from vlorql_core and
vlorql_llm are re-exported here so callers only need to
depend on the vlorql crate.
Re-exports§
pub use builder::VlorQlBuilder;
Modules§
- builder
- Builder for
VlorQl(re-exported from thebuildersubmodule). - execute
- Database executors for running compiled SQL queries.
Structs§
- Compile
Cache - A cache for
CompiledQueryvalues keyed by plan hash + dialect. - Compiled
Query - A SQL statement together with its ordered bind parameters and dialect.
- Dialect
Config - A configurable SQL dialect definition loaded from TOML/YAML.
- Dialect
Profile - The SQL capabilities allowed for one query-planning context.
- Dialect
Registry - Error
Response - The response shape exposed by API and LLM-facing layers.
- Example
Pair - A pair of (question, expected plan) for few-shot examples.
- LlmConfig
- Provider-agnostic LLM configuration.
- Optimized
Plan - A query plan that has been validated and optimized.
- Parameter
- One ordered value bound to a generated SQL placeholder.
- Prompt
Cache - A cache for system prompt strings keyed by
PromptCacheKey. - Prompt
Skill - A skill that injects custom instructions, simplifies schema, or adds examples.
- Query
Optimizer Core QueryPlan.- Rewrite
Engine - Applies a set of rewrite rules to generated SQL.
- Rewrite
Rule - One rewrite rule: match with regex, replace with template.
- Schema
Cache - A cache for
SchemaSnapshotvalues keyed by version + source. - Schema
Cache Key - Key used to cache schema snapshots by version and source.
- Schema
Snapshot - A database schema snapshot used for plan validation and prompt construction.
- Stream
Result - Result of
stream_plan(). The stream emits text deltas; after the stream ends,usagecontains the provider’s token usage (if any). - Token
Usage - Token usage returned by an LLM provider.
- Validated
Plan - A query plan that has passed schema, policy, operand, and dialect validation.
- Validation
Errors - A collection of validation errors returned after validating a whole request.
- VlorQl
- The high-level VlorQl API.
Enums§
- LlmProvider
- Supported LLM providers.
- SqlDialect
- SQL dialects supported by the initial compiler set.
- Stream
Event - One item in the high-level stream emitted by
VlorQl::query_stream.
Traits§
- LlmClient
- A client that turns a natural-language question into a structured query plan.
Functions§
- create_
llm_ client - Creates an LLM client from a populated
LlmConfig. - detect_
template_ leak - Returns a descriptive error message when
contentcontains raw chat-template tokens (<|im_start|>,<|im_end|>), which indicate the model did not understand the output format constraint. - parse_
query_ plan - Run the full V2 pipeline: raw LLM text → validated, optimized
QueryPlan. - parse_
query_ plan_ lenient - Run the full pipeline but skip validation (for debugging / lenient mode).