prompeta 0.1.0

Declarative prompt engineering with semantic roles and pluggable rendering strategies
Documentation
  • Coverage
  • 100%
    37 out of 37 items documented1 out of 25 items with examples
  • Size
  • Source code size: 29.09 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 639.62 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 1s Average build duration of successful builds.
  • all releases: 1m 1s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • oriongonza

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 prompeta::{Prompt, ContentRole};

let prompt = Prompt::new()
    .instruction("You are a helpful assistant.")
    .context("User profile", "Name: Alice, Role: Engineer")
    .focus("Current task", "Debug the authentication module")
    .constraint("Do not modify production database")
    .schema(serde_json::json!({
        "diagnosis": "string",
        "fix": "string",
        "confidence": "float 0-1"
    }));

// 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.