generate
function creates realistic examples of any type. It transforms () → T
, making it easy to produce:
- Test data (“Generate a plausible email address” → “sarah.jones@company.com”)
- Sample content (“Generate a product description” → “Sleek wireless earbuds with…”)
- Structured examples (“Generate a recipe” → Recipe(title=“Lemon Garlic Pasta”, ingredients=[…]))
generate
function is a convenient wrapper around Marvin’s task system - see Tasks for more details.
Usage
Generate a simple string:Parameters
target
: The type of data to generaten
: Number of examples to generate (default: 1)instructions
: Optional guidance for generationagent
: Optional custom agent to usethread
: Optional thread for conversation contextcontext
: Optional additional context