Skip to main content

Dotprompt: Executable GenAI Prompt Templates

Dotprompt is an executable prompt template file format for Generative AI. It is designed to be agnostic to programming language and model provider to allow for maximum flexibility in usage. Dotprompt extends the popular Handlebars templating language with GenAI-specific features.

What's an executable prompt template?

An executable prompt template is a file that contains not only the text of a prompt but also metadata and instructions for how to use that prompt with a generative AI model. Here's what makes Dotprompt files executable:

  • Metadata Inclusion: Dotprompt files include metadata about model configuration, input requirements, and expected output format. This information is typically stored in a YAML frontmatter section at the beginning of the file.

  • Self-Contained Entity: Because a Dotprompt file contains all the necessary information to execute a prompt, it can be treated as a self-contained entity. This means you can "run" a Dotprompt file directly, without needing additional configuration or setup in your code.

  • Model Configuration: The file specifies which model to use and how to configure it (e.g., temperature, max tokens).

  • Input Schema: It defines the structure of the input data expected by the prompt, allowing for validation and type-checking.

  • Output Format: The file can specify the expected format of the model's output, which can be used for parsing and validation.

  • Templating: The prompt text itself uses Handlebars syntax, allowing for dynamic content insertion based on input variables.

This combination of features makes it possible to treat a Dotprompt file as an executable unit, streamlining the process of working with AI models and ensuring consistency across different uses of the same prompt.

Example .prompt file

Here's an example of a Dotprompt file that extracts structured data from provided text:

---
model: googleai/gemini-flash-latest
input:
  schema:
    text: string
output:
  format: json
  schema:
    name?: string, the full name of the person
    age?: number, the age of the person
    occupation?: string, the person's occupation
---
Extract the requested information from the given text. If a piece of information is not
present, omit that field from the output. Text:
{{text}}

This Dotprompt file:

  1. Specifies the use of the googleai/gemini-flash-latest model.
  2. Defines an input schema expecting a text string.
  3. Specifies that the output should be in JSON format.
  4. Provides a schema for the expected output, including fields for name, age, and occupation.
  5. Uses Handlebars syntax ({{text}}) to insert the input text into the prompt.

When executed, this prompt would take a text input, analyze it using the specified AI model, and return a structured JSON object with the extracted information.

Runtime context

Prompt input and runtime context are separate namespaces. Use {{name}} for input and {{@name}} for context:

from dotpromptz import DataArgument, Dotprompt

# 1. Initialize compiler
prompt = Dotprompt()

# 2. Render prompt with isolated input and context
result = await prompt.render(
    '{{name}} is signed in as {{@name}}',
    DataArgument(
        input={'name': 'Ada'},
        context={'name': 'admin'},
    ),
)

# 3. Access rendered output
print(result.messages[0].content[0].text)
# => Ada is signed in as admin

Metadata

Release files for dotpromptz 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dotpromptz 1.0.0
File Size Uploaded Provenance Actions
dotpromptz-1.0.0.tar.gz 91.0 kB With provenance Details for dotpromptz-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dotpromptz 1.0.0
File Interpreter ABI Platform Actions
dotpromptz-1.0.0-py3-none-any.whl Python 3 none any Details for dotpromptz-1.0.0-py3-none-any.whl

Total release size: 161.5 kB

Release files / dotpromptz-1.0.0.tar.gz

Download URL dotpromptz-1.0.0.tar.gz
Size 91.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ced2d9a27cff2a4567e5979e49886b1f7aea5c8ac671b5a25dccff8c155172ce
BLAKE2b-256 checksum
How to use checksums
2940a045e41e4e84f804e7cabf4a1b6f867ab9415483b97b5d7ec96c16889b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / dotpromptz-1.0.0-py3-none-any.whl

Download URL dotpromptz-1.0.0-py3-none-any.whl
Size 70.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23abd376b9415f4f8bd1fba94f65094b59afb5c0eda340b13bbbdbdc0af9d150
BLAKE2b-256 checksum
How to use checksums
a7effe44d13a67352d3d712d5ab268e045d4099547bdb58c8888044cd45d323f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for dotpromptz 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dotpromptz-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page