5a558eb09e
TypeScript SDK Compatibility V1.x E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / TypeScript SDK Compatibility V1.x E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
TypeScript SDK E2E Tests / TypeScript SDK E2E Tests Node ${{matrix.node_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
Python SDK E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK E2E Tests / Python SDK E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK E2E Tests / build-opik (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Select Python version matrix (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / Python SDK Compatibility V1.x E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Python SDK Compatibility V1.x E2E Tests / build-opik (push) Has been cancelled
TypeScript SDK E2E Tests / Select Node version matrix (push) Has been cancelled
TypeScript SDK E2E Tests / build-opik (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer E2E Tests Python ${{matrix.python_version}} (push) Has been cancelled
Opik Optimizer - E2E Tests / Opik Optimizer Integration Smoke Tests (push) Has been cancelled
🐙 Code Quality / detect (push) Has been cancelled
🐙 Code Quality / lint (${{ matrix.leg.name }}) (push) Has been cancelled
🐙 Code Quality / summary (push) Has been cancelled
TypeScript SDK Library Integration Tests / Check Secrets (push) Has been cancelled
TypeScript SDK Library Integration Tests / opik-vercel (Vercel AI SDK / eve) (push) Has been cancelled
SDK Library Integration Tests Runner / Check Secrets (push) Has been cancelled
SDK Library Integration Tests Runner / Missed OpenAI API Key Warning (push) Has been cancelled
SDK Library Integration Tests Runner / Build (push) Has been cancelled
SDK Library Integration Tests Runner / openai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_tests (push) Has been cancelled
SDK Library Integration Tests Runner / langchain_legacy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / llama_index_tests (push) Has been cancelled
SDK Library Integration Tests Runner / anthropic_tests (push) Has been cancelled
SDK Library Integration Tests Runner / mistral_tests (push) Has been cancelled
SDK Library Integration Tests Runner / groq_tests (push) Has been cancelled
SDK Library Integration Tests Runner / aisuite_tests (push) Has been cancelled
SDK Library Integration Tests Runner / haystack_tests (push) Has been cancelled
SDK Library Integration Tests Runner / dspy_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / crewai_v1_tests (push) Has been cancelled
SDK Library Integration Tests Runner / genai_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_tests (push) Has been cancelled
SDK Library Integration Tests Runner / adk_legacy_1_3_0_tests (push) Has been cancelled
SDK Library Integration Tests Runner / evaluation_metrics_tests (push) Has been cancelled
SDK Library Integration Tests Runner / bedrock_tests (push) Has been cancelled
SDK Library Integration Tests Runner / litellm_tests (push) Has been cancelled
SDK Library Integration Tests Runner / harbor_tests (push) Has been cancelled
SDK Library Integration Tests Runner / Slack Notification (push) Has been cancelled
Lint Opik Helm Chart / render-equality (push) Has been cancelled
Opik Optimizer - Unit Tests / Opik Optimizer Unit Tests Python ${{matrix.python_version}} (push) Has been cancelled
Python BE E2E Tests / Python BE E2E (push) Has been cancelled
Python Backend Tests / run-python-backend-tests (push) Has been cancelled
Python SDK Unit Tests / Python SDK Unit Tests ${{matrix.python_version}} (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
SDK E2E Libraries Integration Tests / Check Secrets (push) Has been cancelled
SDK E2E Libraries Integration Tests / Missed OpenAI API Key Warning (push) Has been cancelled
SDK E2E Libraries Integration Tests / build-opik (push) Has been cancelled
SDK E2E Libraries Integration Tests / E2E Lib Integration Python ${{matrix.python_version}} (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-gemini) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-langchain) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-openai) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-otel) (push) Has been cancelled
TypeScript SDK Integration Build & Publish / build-and-publish (opik-vercel) (push) Has been cancelled
TypeScript SDK Build & Publish / build-and-publish (push) Has been cancelled
TypeScript SDK Unit Tests / Test on Node ${{ matrix.node-version }} (push) Has been cancelled
Backend Tests / discover-tests (push) Has been cancelled
Backend Tests / ${{ matrix.name }} (push) Has been cancelled
Build and Publish SDK / build-and-publish (push) Has been cancelled
Build Opik Docker Images / set-version (push) Has been cancelled
Build Opik Docker Images / build-backend (push) Has been cancelled
Build Opik Docker Images / build-sandbox-executor-python (push) Has been cancelled
Build Opik Docker Images / build-python-backend (push) Has been cancelled
Build Opik Docker Images / build-frontend (push) Has been cancelled
Build Opik Docker Images / create-git-tag (push) Has been cancelled
ClickHouse Migration Cluster Check / validate-clickhouse-migrations (push) Has been cancelled
Docs - Publish / run (push) Has been cancelled
E2E Tests - Post Merge (v2) / 🧪 E2E v2 Tests (${{ github.event.inputs.tier || 't1' }}) (push) Has been cancelled
E2E Tests - Post Merge (v2) / 📢 Slack Notification (push) Has been cancelled
Frontend Unit Tests / Test on Node 20 (push) Has been cancelled
Guardrails E2E Tests / Select Python version matrix (push) Has been cancelled
Guardrails E2E Tests / Guardrails E2E Tests ${{matrix.python_version}} (push) Has been cancelled
Guardrails E2E Tests / 📢 Slack Notification (push) Has been cancelled
Guardrails Backend Unit Tests / Guardrails Backend Unit Tests (push) Has been cancelled
Guardrails Backend Unit Tests / 📢 Slack Notification (push) Has been cancelled
Lint Opik Helm Chart / lint-helm-chart (Helm v3.21.0) (push) Has been cancelled
Lint Opik Helm Chart / lint-helm-chart (Helm v4.2.0) (push) Has been cancelled
Lint Opik Helm Chart / unittest-helm-chart (push) Has been cancelled
153 lines
10 KiB
Plaintext
153 lines
10 KiB
Plaintext
---
|
|
description: Find answers to common questions about Opik Agent Optimizer, including
|
|
optimizer selection, configuration, usage, and best practices.
|
|
headline: FAQ | Opik Documentation
|
|
og:description: Enhance your prompt and agent performance using Opik's advanced optimization
|
|
algorithms for better results.
|
|
og:site_name: Opik Documentation
|
|
og:title: Optimize Your Agents with Opik
|
|
subtitle: Common questions about the Opik Agent Optimizer
|
|
title: Optimizer Frequently Asked Questions
|
|
---
|
|
|
|
## Getting started
|
|
|
|
<AccordionGroup>
|
|
<Accordion title="Why should I use the Opik Agent Optimizer?">
|
|
The Agent Optimizer provides a unified interface for optimizing **your existing prompts and
|
|
agents** with cutting edge optimization algorithms. In addition to giving you access to cutting
|
|
edge academic optimizers like GEPA, we also provide a set of algorithms that have been developed
|
|
in-house based on production applications.
|
|
|
|
The optimizer will allow you to improve the performance of your agents without the need for
|
|
manual prompt engineering. You can also use the optimizer to reduce the size of the prompts in
|
|
your agents, reducing cost and latency while maintaining performance.
|
|
</Accordion>
|
|
<Accordion title="How do I get started with the Optimizer ?">
|
|
To get started, you will need:
|
|
1. The prompt you want to optimize
|
|
2. A dataset of examples to optimizer on, you can start with as little as 10
|
|
3. A metric to evaluate the performance of the prompt
|
|
|
|
Once you have these, check out the [Quickstart Guide](/development/optimization-runs/quickstart)
|
|
to run your first optimization.
|
|
</Accordion>
|
|
<Accordion title="Can you help me optimize my prompt ?">
|
|
Yes, we would be more than happy to help you setup the Opik Optimizer for your use case ! You can
|
|
join our [Slack community](https://chat.comet.com) and ask for help there.
|
|
</Accordion>
|
|
</AccordionGroup>
|
|
|
|
## Optimization Algorithms
|
|
|
|
<AccordionGroup>
|
|
<Accordion title="What are the supported optimization algorithms?">
|
|
Opik Agent Optimizer supports a wide range of optimization algorithms including:
|
|
- [HRPO (Hierarchical Reflective Prompt Optimizer)](/development/optimization-runs/algorithms/hierarchical_adaptive_optimizer)
|
|
- [GEPA Optimization](/development/optimization-runs/algorithms/gepa_optimizer)
|
|
- [Evolutionary Optimization](/development/optimization-runs/algorithms/evolutionary_optimizer)
|
|
- [Few-shot Bayesian Optimization](/development/optimization-runs/algorithms/fewshot_bayesian_optimizer)
|
|
- [MetaPrompt Optimization](/development/optimization-runs/algorithms/metaprompt_optimizer)
|
|
|
|
If you would like us to add a new optimization algorithm, simply create an issue on our
|
|
[GitHub repository](https://github.com/comet-ml/opik/issues) and we will be happy to add it !
|
|
</Accordion>
|
|
<Accordion title="How do I choose the right optimizer for my task?">
|
|
Knowing which optimizer to use depends on your specific needs. As a rule of thumb, we recommend
|
|
starting with [HRPO (Hierarchical Reflective Prompt Optimizer)](/development/optimization-runs/algorithms/hierarchical_adaptive_optimizer)
|
|
as this has been shown to be a strong baseline for most tasks.
|
|
|
|
You can also try to use:
|
|
1. GEPA: This is one of the top performing academic optimizers and is a good option if you have a
|
|
complex task.
|
|
2. FewShotBayesianOptimizer: If you have a task that is quite repetitive in the formatting of the prompt
|
|
and responses then this is a good option.
|
|
|
|
</Accordion>
|
|
<Accordion title="How long should I run the optimization for?">
|
|
While some optimizations run for shorts period of time, it is common for optimizations to take a
|
|
couple of hours to complete. As you are starting out, we recommend setting the `max_trials`
|
|
parameter to a reasonable number and increasing / decreasing it as you go.
|
|
</Accordion>
|
|
<Accordion title="How many dataset samples do I need?">
|
|
The number of samples you need depends on your task. As a rule of thumb, we recommend starting with
|
|
at least 10 samples. The more samples you have, the more accurate the optimization will be.
|
|
</Accordion>
|
|
<Accordion title="What models are supported for optimization?">
|
|
The Opik Agent Optimizer uses [LiteLLM](https://docs.litellm.ai/) to support 100+ LLM providers including:
|
|
- **OpenAI** (GPT-4o, GPT-4o-mini, o1, o3-mini)
|
|
- **Anthropic** (Claude 3.5 Sonnet, Claude 3 Opus)
|
|
- **Google Gemini** (Gemini 2.0 Flash, Gemini 1.5 Pro)
|
|
- **Azure OpenAI**
|
|
- **Ollama** (local models like Llama 3, Mistral)
|
|
- **OpenRouter** (access to multiple providers)
|
|
|
|
Models use the LiteLLM format: `provider/model-name` (e.g., `gemini/gemini-2.0-flash`).
|
|
|
|
<Tip>
|
|
See the [Configure LLM Providers](/development/optimization-runs/optimization/configure_models) guide for detailed setup instructions and examples for each provider.
|
|
</Tip>
|
|
</Accordion>
|
|
<Accordion title="The performance is not improving, what should I do?">
|
|
There are a few things you can try to improve the performance of your optimization:
|
|
1. Review your optimization metric, ideally it should provide the model with an insightful
|
|
`reason` for the score it gives. By improving the quality of the metric, the optimizer will be
|
|
able to make better optimizations.
|
|
2. Review your dataset, ideally it should be a diverse set of examples that cover the different
|
|
scenarios you want to optimize for.
|
|
3. Use more powerful models for both the chatPrompt model and the optimizer, as models get more
|
|
powerful, they will be able to generate better optimizations.
|
|
</Accordion>
|
|
</AccordionGroup>
|
|
|
|
## Common Errors
|
|
|
|
For frequent setup and usage errors, head to [Known Issues](/development/optimization-runs/known_issues). We keep the error catalog there so fixes and version notes stay in one place.
|
|
|
|
## Open challenges & advanced topics
|
|
|
|
<AccordionGroup>
|
|
<Accordion title="Why do some optimized prompts look like gibberish?">
|
|
Research has shown "evil twin" prompts and unusual delimiters can perform well despite being hard to interpret. Optimizers explore the search space indiscriminately, so high-performing instructions aren't always human-readable. When interpretability matters, prefer algorithms like HRPO that include reasoning traces or enforce structure via custom metrics.
|
|
</Accordion>
|
|
<Accordion title="How expensive are optimizers in terms of API calls?">
|
|
Cost varies widely. Reflection-heavy optimizers (e.g., HRPO, GEPA) may call LLMs multiple times per trial, while MetaPrompt/Few-Shot Bayesian are lighter weight. Start with small `n_samples` and `max_trials`, monitor API usage, and review the [Benchmarks](/development/optimization-runs/algorithms/benchmarks) page for sample-efficiency notes.
|
|
</Accordion>
|
|
<Accordion title="Do optimized prompts generalize across tasks?">
|
|
Optimizers tune prompts for the dataset you provide. Prompts may overfit if the dataset lacks coverage. Use diverse datasets, consider chaining optimizers (e.g., Evolutionary → Few-Shot Bayesian) to encourage generalization, and re-evaluate on unseen samples before shipping.
|
|
</Accordion>
|
|
<Accordion title="How can I avoid overfitting during optimization?">
|
|
To prevent overfitting, use the `validation_dataset` parameter when calling `optimize_prompt()`. This separates your data into training (for generating prompt improvements) and validation (for evaluating candidate prompts). The optimizer will use the training dataset to understand failure modes and generate improvements, then rank candidates using the validation dataset. This mirrors standard ML practices and helps ensure your optimized prompt generalizes to unseen data.
|
|
|
|
```python
|
|
result = optimizer.optimize_prompt(
|
|
prompt=my_prompt,
|
|
dataset=training_dataset, # Used for analysis and improvements
|
|
validation_dataset=validation_dataset, # Used for ranking candidates
|
|
metric=my_metric,
|
|
max_trials=5,
|
|
)
|
|
```
|
|
|
|
If you don't provide a validation dataset, the optimizer will use the same dataset for both training and validation, which may lead to overfitting on that specific dataset. For best results, split your data 70/30 or 80/20 between training and validation sets.
|
|
</Accordion>
|
|
<Accordion title="Can I optimize for more than one objective (accuracy, cost, safety, etc.)?">
|
|
Yes—compose metrics using `MultiMetricObjective` or custom heuristics so optimizers weigh multiple goals. For complex trade-offs, capture human preferences in the metric reasons, or explore Pareto-aware optimizers like GEPA that surface trade-offs between accuracy and cost.
|
|
</Accordion>
|
|
<Accordion title="What about multimodal or agent workflows?">
|
|
Opik supports optimizing prompts that handle images/videos, as well as agents built with LangGraph, Google ADK, or MCP toolchains. Use the [Optimize agents](/development/optimization-runs/optimization/optimize_agents) and [Optimize multimodal](/development/optimization-runs/optimization/optimize_multimodal) guides for modality-specific advice.
|
|
</Accordion>
|
|
<Accordion title="How reliable are optimizer metrics?">
|
|
LLM-based metrics can be noisy. Always include deterministic checks when possible, and ensure your `ScoreResult.reason` is informative so reflective optimizers can identify true failure modes. See [Define metrics](/development/optimization-runs/optimization/define_metrics) and [Custom metrics](/development/optimization-runs/advanced/custom_metrics) for best practices.
|
|
</Accordion>
|
|
<Accordion title="Are there safety or ethical considerations?">
|
|
Yes. When optimizing prompts that handle sensitive content, bake alignment constraints into your dataset/metrics (e.g., moderation scores) and review outputs manually before deployment. Multi-objective setups help enforce safety alongside accuracy.
|
|
</Accordion>
|
|
</AccordionGroup>
|
|
|
|
## Next Steps
|
|
|
|
- Explore [API Reference](/development/optimization-runs/advanced/api_reference) for detailed technical documentation.
|
|
- Review the individual Optimizer pages under [Optimization Algorithms](/development/optimization-runs/algorithms/overview).
|
|
- Check out the [Quickstart Guide](/development/optimization-runs/quickstart).
|