# Optimize - each trial evaluates 3 candidates, picks best
optimizer = MetaPromptOptimizer(model="gpt-4o")
result = optimizer.optimize_prompt(
    prompt=prompt,
    dataset=my_dataset,
    metric=extraction_accuracy,
)

print(f"Best prompt score: {result.score}")
```

## Related

* [Optimize prompts](/agent_optimization/optimization/optimize_prompts) - Core optimization guide
* [Define metrics](/agent_optimization/optimization/define_metrics) - Create custom metrics
* [Custom metrics](/agent_optimization/advanced/custom_metrics) - Advanced metric patterns
* [API Reference](/agent_optimization/advanced/api_reference) - Full parameter documentation