Skip to main content

Dotpromptz is a language-neutral executable prompt template file format for Generative AI.

Project description

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-1.5-pro
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-1.5-pro 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotpromptz-0.1.3.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotpromptz-0.1.3-py3-none-any.whl (52.5 kB view details)

Uploaded Python 3

File details

Details for the file dotpromptz-0.1.3.tar.gz.

File metadata

  • Download URL: dotpromptz-0.1.3.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dotpromptz-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a2cbe11d150637afc7afc48d6697d4ae059960bc28efdc7b4e4c2a722df49d33
MD5 680e05edb8d9be24fcc794fe2b269f3e
BLAKE2b-256 5b6b5b78c721d73e4e22c37e95d8cdd45014c3d075305dfb26eb23429a22b743

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotpromptz-0.1.3.tar.gz:

Publisher: publish_python_dotpromptz_package.yml on google/dotprompt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dotpromptz-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: dotpromptz-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 52.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dotpromptz-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bcbd385404b0ad3e51e3680fb47940fb517776d1bd540d632e9a8a9b405aec0e
MD5 d6fda0e28ad0a25136a155e8bf53a4b0
BLAKE2b-256 d61c4fab0f84db8f2e1affaca53d09b34f8f0ec46befd5887451c44e4dacd9d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for dotpromptz-0.1.3-py3-none-any.whl:

Publisher: publish_python_dotpromptz_package.yml on google/dotprompt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page