Declarative DSL
Compose conversation blueprints like React components, turning dataset design into a predictable, readable workflow.
Like React, but for datasets โ declarative and typesafe DSL for composing conversations and generating thousands of AI-powered training examples.
import {
generateDataset,
generatedUser,
generatedAssistant,
assistant,
oneOf,
} from "@qforge/torque";
import { openai } from "@ai-sdk/openai";
await generateDataset(
() => [
generatedUser({ prompt: "Friendly greeting or introduction" }), // AI generated
oneOf([
// pick one randomly (weights are optional)
{ value: assistant({ content: "Hello!" }), weight: 0.3 }, // static
generatedAssistant({ prompt: "Respond to greeting" }), // AI generated, gets remaining weight
]),
...times(between(1, 3), [
generatedUser({
prompt: "Chat about weather. Optionally mentioning previous message",
}),
generatedAssistant({ prompt: "Respond to user. Short and concise." }),
]),
],
{
count: 2, // number of examples
model: openai("gpt-5-mini"), // any ai-sdk model
seed: 42, // replayable RNG
metadata: { example: "quick-start" }, // optional per-row metadata
}
);Torque borrows from the best product-engineering playbooks: versioned blueprints, strict typing, reproducible runs, and streaming observability. No YAML, no bespoke tools โ just code.
Compose conversation blueprints like React components, turning dataset design into a predictable, readable workflow.
Harness Zod-powered typing with end-to-end inference so every AI training workflow stays safe, reliable, and maintainable.
Generate with OpenAI, Anthropic, DeepSeek, vLLM, LLaMA.cpp, or any model supported by your composable data pipeline.
Blend handcrafted prompts with AI dataset generation to produce realistic multi-message conversations at scale.
Reuse context across runs to minimize token spend while keeping dataset scaling fast, efficient, and reproducible.
Stream progress in a beautiful CLI with concurrent workers, deterministic seeds, and instant feedback loops.
Every team building AI products hits the same roadblocks when trying to create high-quality training data at scale.
Sometimes you don't have enough real data
Maintaining quality and consistency across thousands of examples is extremely time consuming
Tool calling patterns require intricate message sequences and are errorโprone
Generating different conversation flows means rewriting everything or creating various hard to maintain scripts
Designing generators that are random yet reproducible is surprisingly complex
Getting AI to understand complex composition scenarios (nested variations, conditional flows) takes significant prompt engineering time
The React moment for dataset generation
Just like React transformed UI development from imperative DOM manipulation to composable components, Torque transforms dataset generation from manual JSON editing to declarative schemas.
Use smaller, cheaper models while benefiting from cache optimization for dramatically lower costs.
Write your dataset logic once, generate thousands of variations automatically
Torque is built for product teams that expect the same polish from their AI training data as they do from their production apps. First, let's take a quick look at the pain that keeps teams from shipping.
Teams hack together prompts in spreadsheets and docs. Scaling to thousands of examples means hours of copy/paste, QA, and regressions.
Without types or policy guards, the first time you catch a broken run is when your agent drifts in production โ an expensive way to discover bugs.
Traditional tooling lacks version control, seeds, or caching. Every update turns into a new round of manual cleanup and token spend.
Torque replaces sprawling prompts and brittle scripts with a composable TypeScript toolkit. Every phase is automated, typed, and observable.
Describe each conversation as a reusable component. Torque keeps prompts, metadata, and policy checks together in strongly typed modules.
Ship new flows faster with versionable building blocks, not ad-hoc scripts.
Spin up tens of workers, hydrate examples with AI, and cache deterministic seeds so teams get repeatable datasets without wasting tokens.
Every run logs audit trails, token spend, and policy results โ plug it straight into CI.
Replay production traffic through model providers, enforce quality gates, and ship regressions straight into Slack or GitHub checks.
Close the loop with built-in evaluations and targeted retries when policies fail.
Join developers building the future of LLM training data
bun add @qforge/torquenpm install @qforge/torque