Skip to main content

Crate vlorql

Crate vlorql 

Source
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 the builder submodule).
execute
Database executors for running compiled SQL queries.

Structs§

CompileCache
A cache for CompiledQuery values keyed by plan hash + dialect.
CompiledQuery
A SQL statement together with its ordered bind parameters and dialect.
DialectConfig
A configurable SQL dialect definition loaded from TOML/YAML.
DialectProfile
The SQL capabilities allowed for one query-planning context.
DialectRegistry
ErrorResponse
The response shape exposed by API and LLM-facing layers.
ExamplePair
A pair of (question, expected plan) for few-shot examples.
LlmConfig
Provider-agnostic LLM configuration.
OptimizedPlan
A query plan that has been validated and optimized.
Parameter
One ordered value bound to a generated SQL placeholder.
PromptCache
A cache for system prompt strings keyed by PromptCacheKey.
PromptSkill
A skill that injects custom instructions, simplifies schema, or adds examples.
QueryOptimizerCore
QueryPlan.
RewriteEngine
Applies a set of rewrite rules to generated SQL.
RewriteRule
One rewrite rule: match with regex, replace with template.
SchemaCache
A cache for SchemaSnapshot values keyed by version + source.
SchemaCacheKey
Key used to cache schema snapshots by version and source.
SchemaSnapshot
A database schema snapshot used for plan validation and prompt construction.
StreamResult
Result of stream_plan(). The stream emits text deltas; after the stream ends, usage contains the provider’s token usage (if any).
TokenUsage
Token usage returned by an LLM provider.
ValidatedPlan
A query plan that has passed schema, policy, operand, and dialect validation.
ValidationErrors
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.
StreamEvent
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 content contains 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).