DotPrompt
DotPrompt lets you load and use .prompt files with Handlebars templating for structured, reusable prompt management.
Loading a prompt
Section titled “Loading a prompt”Place .prompt files in resources/prompts/:
resources/ prompts/ recipe.prompt recipe.robot.prompt # variant// Load a prompt from resources/prompts/recipe.promptExecutablePrompt<RecipeInput> recipePrompt = genkit.prompt("recipe", RecipeInput.class);
// Execute with typed inputModelResponse response = recipePrompt.generate(new RecipeInput("pasta carbonara"));Prompt variants
Section titled “Prompt variants”Variants let you create alternate versions of a prompt (e.g., different tones or personalities):
ExecutablePrompt<RecipeInput> robotPrompt = genkit.prompt( "recipe", RecipeInput.class, "robot");Structured output from prompts
Section titled “Structured output from prompts”Prompts work with structured output generation:
ExecutablePrompt<DishRequest> prompt = genkit.prompt("italian-dish", DishRequest.class);MenuItem dish = prompt.generate(new DishRequest("Italian"), MenuItem.class);Prompt file format
Section titled “Prompt file format”Prompt files use Handlebars templates with YAML frontmatter:
---model: openai/gpt-4o-miniconfig: temperature: 0.9 maxOutputTokens: 500input: schema: ingredient: string style?: string---Create a {{style}} recipe using {{ingredient}} as the main ingredient.Include step-by-step instructions.