Principle:Wandb Weave Prompt Definition
| Knowledge Sources | |
|---|---|
| Domains | Prompt_Engineering, NLP |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
A structured template system that defines parameterized prompts for reproducible LLM interactions.
Description
Prompt Definition provides three levels of abstraction for creating LLM prompts: (1) String templates with simple variable substitution, (2) Message-based templates for chat-format prompts with role-content pairs, and (3) Fluent builder prompts with advanced features like requirements, configuration, and binding.
All prompt types support template variable substitution using Python's str.format() syntax and integrate with the Weave versioning system for reproducible prompt management.
Usage
Use this principle when creating prompts that need to be versioned, shared, or parameterized. Choose StringPrompt for simple text, MessagesPrompt for chat APIs, or EasyPrompt for advanced prompt engineering workflows.
Theoretical Basis
Prompt templates follow the parameterized template pattern:
- Template Definition: A string or message list with {variable} placeholders.
- Variable Binding: Replace placeholders with actual values at call time via format().
- Type Safety: Missing variables raise IncorrectPromptVarError rather than producing malformed output.
- Composition: Templates can be nested, concatenated, and configured.