How google/dotprompt works
Project type and purpose
• Dotprompt is an open-source, multi-language SDK and tooling suite for “executable GenAI prompt templates.”
• It defines a file format (.prompt / YAML frontmatter + Handlebars) plus a core specification, and provides language-specific implementations (Go, JavaScript/TypeScript, Python, Java, Rust), a test harness, documentation site, and CI/CD scaffolding.
File structure
• Top-level: Bazel configs, GitHub workflows, language directories (go/, js/, python/, java/, rs/), core specification (spec/), third-party docsite (Astro), build/test scripts (scripts/), and CI config.
• spec/: YAML definitions of picoschema and template specification → the canonical format.
• go/, js/, python/, java/, rs/: each contains source, tests, build configs, adapters.
• third_party/docsite/: static site generator for docs and examples.
• scripts/: automation helpers for linting, building, testing, formatting, and release.
• CI workflows trigger on changes to each language, spec, docs, and publish packages.
README for additional insights
• Describes the core concept: executable prompt templates include metadata (model, input schema, output schema) + templating engine.
• Shows example usage in JavaScript via Genkit plugin.
• Mentions extensibility via implementations for other languages and providers (openai, gemini).
Elements
• Clear labels for each component (e.g., “Core Spec,” “Runtime Engine,” “Go SDK,” “OpenAI Adapter,” “Docsite”)
• .prompt file → Runtime Engine → Adapter → Model Provider → Runtime Engine → SDK → User code
• spec/ → SDKs and Docsite
• scripts/ → CI pipelines
• Adapters / external services (e.g., green)
• Docs & CI (e.g., grey)