HTML Prompt Response Construction

HPRC Documentation

An AI-native server-side templating engine that integrates with any web framework — FastAPI, Flask, Django — or runs standalone. Embed LLM prompts directly inside your HTML and have them executed during rendering — like JSP or PHP, but for prompts.

HPRC — execute LLM prompts the same way your server renders HTML, right inside the template. Prompts as first-class HTML elements. v0.1.0 Python 3.9+ Provider-independent Async
installbash
pip install hprc-framework        # then: import hprc

What HPRC does

You write a normal HTML page and drop <prompt> blocks into it. At render time, HPRC resolves each prompt's text (filling in data, request parameters and the responses of other prompts), figures out the execution order automatically, runs prompts concurrently where it can, caches results, and stitches each <response> back into the final HTML. Prompts themselves are tacit — they never appear in the output.

🫥

Tacit prompts

Prompt blocks execute but never render. Only <response> placeholders emit text.

🔗

Auto dependencies

One prompt can <include> another's response. HPRC builds the graph and orders execution for you.

Concurrent

Independent prompts in the same level run together with asyncio.

🧩

Pluggable

Swap the LLM provider, rules, tools and cache through one HPRCConfig.

📜

Declarative

Named rules & tools — no expression language in templates; business logic stays in Python.

🗄️

Cached

Per-prompt TTL caching keyed on everything that determines the output.

Thirty-second taste

customer.sprep.htmlhtml
<h1>Hello <fill>customer.name</fill></h1>

<prompt id="summary" model="gpt-5" condition="is_premium" cache="24h">
  Summarize the account for <fill>customer.name</fill>
  who is interested in <param>product</param>.
</prompt>

<section><response id="summary"/></section>
app.pypython
import hprc
from hprc import HPRCConfig, MockLLMClient

config = HPRCConfig(
    llm_client=MockLLMClient(),
    rules={"is_premium": lambda ctx: ctx["customer"]["tier"] == "premium"},
)

html = await hprc.render_template(
    template_path="customer.sprep.html",
    request={"query": {"product": "WidgetPro"}, "path": {}, "method": "GET"},
    bindings={"customer": {"name": "Ada", "tier": "premium"}},
    config=config,
)

The application developer writes no prompt-orchestration logic. See the User Guide for the full walkthrough.

Status

Open source (Apache-2.0). Version 0.1.0 (Alpha). Created by Rajesh Ramani. Early release — contributions and feedback welcome.

HPRC Framework · Created by Rajesh Ramani · SPREP Templates: Simple Prompt Response Embedded Pages