prompeta 🎺
Declarative prompt engineering with semantic roles and pluggable rendering strategies.
Instead of building prompts as strings, you declare content with semantic roles
(instruction, context, focus, constraint, example, schema) and a [PromptStrategy]
renders the final text using best-practice prompt engineering.
Quick start
use ;
let prompt = new
.instruction
.context
.focus
.constraint
.schema;
// Renders using the default ClaudeStrategy
let text = prompt.to_string;
Key concepts
- Content roles — Each block of content has a semantic role that tells the renderer how to format and order it.
- Pluggable strategies — The [
PromptStrategy] trait lets you swap rendering logic per model family. A [ClaudeStrategy] is provided by default. - Budget trimming — [
Prompt::trim_to_budget] removes lowest-priority blocks until the output fits within a character budget. - Tag-based manipulation — Block-level tags let you surgically remove or replace content without position-dependent code.