zerda.prompt — RAG Prompt Orchestration Engine
On this page
zerda.prompt is a Python library for building AI-ready, context-aware prompts for Retrieval-Augmented Generation (RAG) systems. It sits between your retriever and your LLM client, turning a query plus a bag of retrieved documents into a fully-assembled, guardrailed, token-budgeted, provider-ready prompt.
from zerda.prompt import PromptEngine
engine = PromptEngine()
prompt = engine.build(
query="What caused the 2008 financial crisis?",
documents=[
{"content": "...", "source": "wiki", "score": 0.92},
],
strategy="multi_hop",
output_format="json",
)
# OpenAI
response = openai_client.chat.completions.create(
model="gpt-4o",
messages=prompt.to_messages(),
)
# Anthropic
payload = prompt.to_anthropic()
response = anthropic_client.messages.create(**payload, model="claude-opus-4-20250514")
Scope note. This documentation describes only what is present in the
promptpackage source (__init__,prompt_engine,builder,context_manager,guardrails,optimizer,types,templates,strategies/__init__,ab_testing.py). No CLI, REST API, database layer, or plugin system exists in this package — the library is a pure in-process prompt-construction toolkit. Anywhere behavior can't be determined from the code, this is stated explicitly rather than guessed.
What it does
Where to go next
- New to the library? Start with Installation then Quickstart.
- Want the big picture first? Read Architecture.
- Need a specific class or function? Go to the API Reference.
- Want task-oriented walkthroughs? See Tutorials.
- Curious what's not verifiable from the source? See FAQ and Changelog.