google/dotprompt

repository·main·Indexed 19 days ago

https://github.com/google/dotprompt

Dotprompt is an executable prompt template file format designed to make GenAI prompts portable, language-agnostic, and self-contained by combining Handlebars templating with YAML-based model and schema configurations.

Tokens
103.5K
Snippets
355
Records
482
Agent score
68%

What's inside dotprompt

  1. Overview of Dotprompt features

    main

    Dotprompt is a language-neutral executable prompt template format. Key features include:

    • YAML Frontmatter: Define prompt metadata such as model, config, and input/output schemas.
    • Handlebars Templating: Includes 7 built-in helpers: role, media, history, section, json, ifEquals, and unlessEquals.
    • Picoschema: A compact schema notation that converts to JSON Schema.
    • Multi-message Support: Use role markers to define multi-turn conversation structures.
    • Named Partials: Supports recursive resolution and includes cycle detection.
    • PromptStore: An interface for managing prompts, with DirStore provided for file system implementations.
    • Extensibility: Supports custom loaders, schema/tool resolvers, and configuration passthrough for tools/functions and safety settings.
  2. What is Dotprompt?

    main

    Dotprompt is an executable prompt template file format for Generative AI. It is designed to be language-agnostic and model-provider-agnostic, allowing prompt engineering to be decoupled from application development.

    Key features include:

    • Metadata Inclusion: Uses YAML frontmatter to store model configuration, input requirements, and expected output formats.
    • Self-Contained Execution: Files contain everything needed to run a prompt, including model settings (e.g., temperature, max tokens).
    • Input Schema: Defines the structure of expected input data for validation and type-checking.
    • Output Format: Specifies the expected format (e.g., JSON) and schema for the model's response.
    • Templating: Extends the Handlebars templating language to allow dynamic content insertion via variables.
  3. Overview of rules_flutter capabilities

    main

    The rules_flutter Bazel ruleset is a production-ready (v1.0.0) implementation for managing Flutter projects within Bazel. It provides a hermetic environment for building, testing, and deploying Flutter applications across multiple platforms.

    Key capabilities include:

    • Core Build Rules: Support for libraries (flutter_library), binaries (flutter_binary), tests (flutter_test), and production applications (flutter_application).
    • Platform Support: Android (APK/AAB), iOS, Web (JS and WASM), macOS, Linux, and Windows.
    • SDK Management: Hermetic SDK downloads with support for different channels (stable/beta/dev) and architecture detection.
    • Developer Experience: Hot reload via flutter_dev_server, IDE integration (IntelliJ/VSCode), and code generation via flutter_build_runner.
    • CI/CD & Tooling: Static analysis (flutter_analyze), formatting checks (flutter_format_check), coverage reporting, and Gazelle extensions for automated BUILD file generation.
  4. Overview of the Promptly Store Angular Frontend

    main

    The Promptly Store web UI is an Angular-based interface designed for managing and evaluating GenAI prompt templates. It provides a Material Design interface for browsing packages, searching with filters, and using a playground for testing prompts.

    Key capabilities include:

    • Package Management: Browse by category/popularity, search with filters (tags, scope, author), and view package details (README, versions, dependencies).
    • Prompt Testing: Use the Prompt Playground to test prompts with sample inputs.
    • Evaluation: Perform Comparative Evaluation (A/B testing) to compare prompt variations side-by-side and view metrics.
    • User & Org Management: Manage owned packages, API tokens, and organization scopes/team members via a User Dashboard.
  5. Key features of Go Dotprompt

    main

    Go Dotprompt is a language-neutral executable prompt template format for Generative AI. Key capabilities include:

    • YAML Frontmatter: Define prompt metadata such as model, config, and input/output schemas.
    • Handlebars Templating: Includes 7 built-in helpers: role, media, history, section, json, ifEquals, and unlessEquals.
    • Picoschema: Uses a compact schema notation that converts to JSON Schema.
    • Multi-message Prompts: Supports prompts with multiple messages and role markers.
    • Named Partials: Supports recursive resolution with built-in cycle detection.
    • PromptStore: Provides a PromptStore interface with a DirStore implementation for file system-based prompt management.
    • Extensibility: Supports custom loaders, schema/tool resolvers, and config passthrough for tools/functions and safety settings.
  6. Features of @dotprompt/codemirror

    main

    The @dotprompt/codemirror package provides the following language support features for .prompt files:

    • Syntax Highlighting: Supports YAML frontmatter, Handlebars templates, and Dotprompt markers.
    • Autocompletion: Provides autocompletion for helpers, frontmatter fields, and model names.
    • Theming: Includes support for both dark and light themes.
  7. Available Dotprompt Runtimes and Packages

    main

    Dotprompt is an executable prompt template file format for Generative AI. It is implemented across multiple languages. Use the package corresponding to your development environment:

    • JavaScript: dotprompt (Reference implementation)
    • Dart: dotprompt (Production)
    • Python: dotpromptz (Production)
    • Go: dotprompt-go (Development)
    • Rust: dotprompt-rs (Development)
    • Java: dotprompt-java (Development)
  8. Features of handlebarrz

    main

    The handlebarrz engine supports several advanced templating features:

    • Built-in Helpers: each, if, unless, with, lookup, and log.
    • Block Helpers: Supports inverse sections (else blocks).
    • Context Navigation: Use this, ../parent, and @root to navigate data.
    • Template Control: Partial templates, blocks, and subexpressions.
    • Whitespace Control: Use the ~ operator to control whitespace.
    • Strict Mode: Option to enable strict mode for missing fields.
    • Customization: Support for custom helper functions and configurable HTML escaping.
  9. Select a Dotprompt language implementation

    main

    Dotprompt is available in multiple languages, each following the same specification to ensure consistent behavior for template parsing, rendering, and message history handling. Choose the package corresponding to your development environment:

    • Python: Use the dotpromptz package.
    • TypeScript/JavaScript: Use the dotprompt package.
    • Go: Use github.com/google/dotprompt/go/dotprompt.
    • Rust: Use the dotprompt crate.
    • Java: Use the com.google.dotprompt package.
  10. What is Picoschema and how to use it in dotprompt

    main

    Picoschema is a compact, YAML-optimized schema definition format designed to describe structured data for generative AI models. It is a subset of JSON Schema capabilities and is used within the schema field of a dotprompt's frontmatter.

    When dotprompt encounters a schema in the frontmatter, it automatically detects whether it is using the Picoschema format or standard JSON Schema. Picoschema is preferred for its conciseness in YAML environments.

    ---
    output:
      schema:
        product:
          id: string, Unique identifier
          price: number
    ---
  11. What is a Dotprompt executable prompt template?

    main

    A Dotprompt file is an executable prompt template format for Generative AI that is language and model provider agnostic. It extends the Handlebars templating language with GenAI-specific features.

    Key features include:

    • Metadata Inclusion: Uses YAML frontmatter to store model configuration, input requirements, and expected output formats.
    • Self-Contained Entity: Contains all necessary information to execute a prompt without additional code-level configuration.
    • Model Configuration: Specifies the model (e.g., googleai/gemini-2.5-pro) and parameters like temperature or max tokens.
    • Input Schema: Defines the structure of input data for validation and type-checking.
    • Output Format: Specifies the expected format (e.g., json) and schema for the model's response.
    • Templating: Uses Handlebars syntax (e.g., {{variable}}) for dynamic content insertion.