Example Walkthroughs
Here are three real-world examples of TVL modules.
1. RAG Support Bot
This example demonstrates a typical Retrieval-Augmented Generation (RAG) setup. It optimizes for quality and latency, with a structural constraint linking the model choice to the retriever configuration.
2. Multi-Tenant Router
This example shows how to use TVL for a SaaS application where different user tiers (Free vs. Enterprise) have different constraints.
- Key Feature:
when user_tier = "free" then ...constraints.
3. Cost Optimization
This example focuses on minimizing cost while maintaining a strict quality floor.
- Key Feature:
derivedconstraintrequire: quality_score >= 4.0.