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
106 lines
6.5 KiB
Plaintext
106 lines
6.5 KiB
Plaintext
---
|
|
description: Learn about the core concepts of Opik Agent Optimizer, including key
|
|
terms, evaluation processes, optimization workflows, and best practices for effective
|
|
LLM optimization.
|
|
headline: Concepts | Opik Documentation
|
|
og:description: Learn to refine agent and prompt optimization in Opik for enhanced
|
|
LLM evaluation and performance.
|
|
og:site_name: Opik Documentation
|
|
og:title: Master Optimization Concepts with Opik
|
|
subtitle: Common terminology and how we optimize
|
|
title: Opik Agent Optimizer Core Concepts
|
|
---
|
|
|
|
## Overview
|
|
|
|
Understanding the core concepts of the Opik Agent Optimizer is essential for unlocking its full
|
|
potential in LLM evaluation and optimization. This section explains the foundational terms,
|
|
processes, and strategies that underpin effective agent and prompt optimization within Opik.
|
|
|
|
## What is Agent Optimization (and Prompt Optimization)?
|
|
|
|
In Opik, **Agent Optimization** refers to the systematic process of refining and evaluating the
|
|
prompts, configurations, and overall design of language model-based applications to maximize their
|
|
performance. This is an iterative approach leveraging continuous testing, data-driven refinement,
|
|
and advanced evaluation techniques.
|
|
|
|
**Prompt Optimization** is a crucial subset of Agent Optimization. It focuses specifically on
|
|
improving the instructions (prompts) given to Large Language Models (LLMs) to achieve desired
|
|
outputs more accurately, consistently, and efficiently. Since prompts are the primary way to
|
|
interact with and guide LLMs, optimizing them is fundamental to enhancing any LLM-powered agent or
|
|
application.
|
|
|
|
`Opik Agent Optimizer` provides tools for both: directly optimizing individual prompt strings and
|
|
also for optimizing more complex agentic structures that might involve multiple prompts, few-shot
|
|
examples, or tool interactions.
|
|
|
|
## Key Terms
|
|
|
|
<AccordionGroup>
|
|
<Accordion title="Optimizer">
|
|
A specialized algorithm within the Opik Agent Optimizer SDK designed to enhance prompt effectiveness. Each optimizer
|
|
(e.g., [`MetaPromptOptimizer`](/development/optimization-runs/algorithms/metaprompt_optimizer),
|
|
[`FewShotBayesianOptimizer`](/development/optimization-runs/algorithms/fewshot_bayesian_optimizer),
|
|
[`EvolutionaryOptimizer`](/development/optimization-runs/algorithms/evolutionary_optimizer),
|
|
[`HRPO`](/development/optimization-runs/algorithms/hierarchical_adaptive_optimizer))
|
|
employs unique strategies and configurable parameters to address specific optimization goals.
|
|
</Accordion>
|
|
<Accordion title="ChatPrompt">
|
|
The object to optimize which contains your chat messages with placeholders for variables that change on each example.
|
|
See the [API Reference](/development/optimization-runs/advanced/api_reference#chatprompt).
|
|
</Accordion>
|
|
<Accordion title="Candidate">
|
|
A concrete prompt (or multi-prompt bundle) produced by an optimizer for evaluation. Candidates are what get scored and compared
|
|
during optimization, and each candidate maps to a specific set of messages, parameters, and tool configuration.
|
|
</Accordion>
|
|
<Accordion title="Metric">
|
|
An object defining how to measure the performance of a prompt. The metric functions should accept two parameters:
|
|
- `dataset_item`: A dictionary with the dataset item keys
|
|
- `llm_output`: This will be populated with the LLM response
|
|
|
|
It should return either a [ScoreResult](https://www.comet.com/docs/opik/python-sdk-reference/Objects/ScoreResult.html) object or a float.
|
|
</Accordion>
|
|
<Accordion title="Dataset (for Optimization)">
|
|
A collection of data items, typically with inputs and expected outputs (ground truth), used to guide and evaluate
|
|
the prompt optimization process. For best results, split your data into separate training and validation datasets—the optimizer uses the training dataset to analyze failures and generate improvements, then evaluates candidates on the validation dataset to prevent overfitting. See [Datasets](/evaluation/advanced/manage_datasets) and [Define datasets](/development/optimization-runs/optimization/define_datasets) for more information.
|
|
</Accordion>
|
|
<Accordion title="Optimization Run">
|
|
A single execution of a prompt optimization process using a specific configuration. For example,
|
|
calling `optimizer.optimize_prompt(...)` once constitutes a Run. Each Run is logged as an Optimization Run
|
|
in Opik and contains multiple rounds, trials, and candidate evaluations.
|
|
</Accordion>
|
|
<Accordion title="Optimization Trial">
|
|
Each optimization run is made up of one or more optimization trials. A trial corresponds to evaluating
|
|
a candidate on the chosen dataset slice (full, sampled, or minibatch). You can view each trial's prompt,
|
|
score, and reasoning history inside the Opik UI to understand optimizer progress.
|
|
</Accordion>
|
|
<Accordion title="Optimization Round">
|
|
A logical iteration within a run where the optimizer proposes one or more candidates, evaluates them,
|
|
and uses the results to decide the next candidates. Some optimizers expose rounds explicitly (e.g., evolutionary,
|
|
hierarchical), while others operate with a simpler trial-by-trial loop.
|
|
</Accordion>
|
|
<Accordion title="Prompt model">
|
|
The model that is used to evaluate the prompt. This is the model that you use the prompt with,
|
|
should be the same as the model you use in your application. Configure it via `ChatPrompt(model="provider/model-name")`.
|
|
|
|
See [Configure LLM Providers](/development/optimization-runs/optimization/configure_models) for setup instructions.
|
|
</Accordion>
|
|
<Accordion title="Optimizer model">
|
|
The model that is used to optimize the prompt. This is the model that the optimizer uses to improve your prompt,
|
|
you will get the best performance by using the most powerful model for the optimization. Configure it via the optimizer's `model` parameter.
|
|
|
|
See [Configure LLM Providers](/development/optimization-runs/optimization/configure_models) for setup instructions.
|
|
</Accordion>
|
|
</AccordionGroup>
|
|
|
|
## Next Steps
|
|
|
|
- Explore specific [Optimizers](/development/optimization-runs/algorithms/overview) for algorithm details.
|
|
- Refer to the [FAQ](/development/optimization-runs/faq) for common questions and troubleshooting.
|
|
- Refer to the [API Reference](/development/optimization-runs/advanced/api_reference) for detailed configuration options.
|
|
|
|
<Info>
|
|
📓 Want to see these concepts in action? Check out our [Example Projects & Cookbooks](/development/optimization-runs/cookbooks/optimizer_introduction_cookbook)
|
|
for step-by-step, runnable Colab notebooks.
|
|
</Info>
|