opik-optimizer

Optimize LLM prompts, tools, and agents in Opik using standardized optimization workflows (prompt optimization, tool optimization, and parameter tuning), dataset/metric hookups, and result interpretation.

Last repository push
GitHub Stars
111
Forks
9
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "opik-optimizer" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-b862ce3a3e1f772a88dbb69f1085b11a26f8861ea33a2bc652041ae0a6b15329. Verify the upstream source and version against https://github.com/vincentkoc/dotskills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Optimize LLM prompts, tools, and agents in Opik using standardized optimization workflows (prompt optimization, tool optimization, and parameter tuning), dataset/metric hookups, and result interpretation.

0 Downloads

Introduction source: third_party · vincentkoc · 0.0.1 Reference

SkillPi interpretation

Tasks
Optimize LLM prompts, tools, and agents in Opik using standardized optimizer workflows (prompt optimization, tool optimization, and parameter tuning), dataset/metric wiring, and result interpretation.
Audience
Use this skill when a user asks for: Choosing and configuring Opik Optimizer algorithms for prompt/agent optimization. Writing `ChatPrompt`-based optimization runs and custom metric functions. Optimizing with tools (function calling or MCP), selected prompt roles, or prompt segments. Tuning LLM call parameters with `optimize_parameter`. Comparing optimizer outputs and interpreting `OptimizationResult`.
Inputs and outputs
Target optimization objective (prompt/tool/parameter) and success metric. Dataset source and expected schema fields. Model/provider constraints and runtime limits. Optional scope constraints (`optimize_prompts` segments, tool fields, project names).
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: opik-optimizer
description: Optimize LLM prompts, tools, and agents in Opik using standardized optimizer workflows (prompt optimization, tool optimization, and parameter tuning), dataset/metric wiring, and result interpretation.
license: MIT
metadata:
  source: "https://github.com/vincentkoc/dotskills"

Opik Optimizer

Purpose

Design, run, and interpret Opik Optimizer workflows for prompts, tools, and model parameters with consistent dataset/metric wiring and reproducible evaluation.

When to use

Use this skill when a user asks for:

  • Choosing and configuring Opik Optimizer algorithms for prompt/agent optimization.
  • Writing ChatPrompt-based optimization runs and custom metric functions.
  • Optimizing with tools (function calling or MCP), selected prompt roles, or prompt segments.
  • Tuning LLM call parameters with optimize_parameter.
  • Comparing optimizer outputs and interpreting OptimizationResult.

Workflow

  1. Select optimizer strategy (MetaPromptOptimizer, FewShotBayesianOptimizer, HRPO, etc.) based on the target optimization goal.
  2. Build prompt/dataset/metric wiring and validate placeholder-field alignment.
  3. Run prompt, tool, or parameter optimization with explicit controls (n_threads, n_samples, max_trials, seed).
  4. Inspect OptimizationResult and compare score deltas against initial baselines.
  5. Summarize recommendations, risks, and next experiments.

Inputs

  • Target optimization objective (prompt/tool/parameter) and success metric.
  • Dataset source and expected schema fields.
  • Model/provider constraints and runtime limits.
  • Optional scope constraints (optimize_prompts segments, tool fields, project names).

Outputs

  • Optimizer run configuration and rationale.
  • Result interpretation (score, initial_score, history trends).
  • Recommended next changes and follow-up experiment plan.

Use the reference files in this skill for details before implementing code:

  • references/algorithms.md
  • references/prompt_agent_workflow.md
  • references/example_patterns.md

Opik Optimizer quickstart

  1. Install and import:
pip install opik-optimizer
from opik_optimizer import ChatPrompt, MetaPromptOptimizer, HRPO, FewShotBayesianOptimizer
from opik_optimizer import datasets
  1. Build a prompt and metric:
from opik.evaluation.metrics import LevenshteinRatio

prompt = ChatPrompt(
    system="You are a concise answerer.",
    user="{question}",
)

def metric(dataset_item: dict, output: str) -> float:
    return LevenshteinRatio().score(
        reference=dataset_item["answer"],
        output=output,
    ).value
  1. Load dataset and run:
dataset = datasets.hotpot(count=30)

result = MetaPromptOptimizer(model="openai/gpt-5-nano").optimize_prompt(
    prompt=prompt,
    dataset=dataset,
    metric=metric,
    n_samples=20,
    max_trials=10,
)
result.display()

Core workflow you should follow

  1. Pick optimizer class:
    • Few-shot examples + Bayesian selection: FewShotBayesianOptimizer
    • LLM meta-reasoning: MetaPromptOptimizer
    • Genetic + MOO / LLM crossover: EvolutionaryOptimizer
    • Hierarchical reflective diagnostics: HierarchicalReflectiveOptimizer (HRPO)
    • Pareto-based genetic strategy: GepaOptimizer
    • Parameter tuning only: ParameterOptimizer
  2. Define a single ChatPrompt (or dict of prompts for multi-prompt cases).
  3. Provide a dataset from opik_optimizer.datasets.
  4. Provide metric callable with signature (dataset_item, llm_output) -> float (or ScoreResult/list of ScoreResult).
  5. Set optimizer controls (n_threads, n_samples, max_trials, seed, etc.).
  6. Run one of:
    • optimize_prompt(...) for prompt/system behavior changes.
    • optimize_parameter(...) for model-call hyperparameters.
  7. Inspect OptimizationResult (score, initial_score, history, optimization_id, get_optimized_parameters).

Key execution details to enforce

  • Prefer explicit project_name for Opik tracking if you are using org-level observability.
  • Keep placeholders in prompts aligned with dataset fields (for example {question}).
  • Start with optimize_prompts="system" or "user" when scope should be constrained.
  • Keep model names in MetaPrompt/reasoning calls provider-compatible for your account.
  • Validate multimodal input payloads by preserving non-empty content segments only.
  • For small datasets, use n_samples and n_samples_strategy carefully; over-allocation auto-falls back to full set.

Tooling and segment-based control

  • Tools can be optimized with MCP/function schema fields, not only by changing prompt wording.
  • For fine-grained text updates, use optimize_prompts values and helper functions from prompt_segments:
    • extract_prompt_segments(ChatPrompt) to inspect stable segment IDs.
    • apply_segment_updates(ChatPrompt, updates) for deterministic edits.
  • Tool optimization is distinct from prompt optimization.

Runnable examples live upstream in the Opik repo:

If you need local runnable scripts, vendor the upstream examples into a scripts/ folder and keep references one level deep.

Common mistakes to avoid

  • Passing empty dataset or mismatched placeholder names.
  • Mixing deprecated constructor arg num_threads with n_threads.
  • Assuming tool optimization is the same as agent function-calling optimization.
  • Running ParameterOptimizer.optimize_prompt (it raises and should not be used).

Next actions

  • For in-depth behavior and per-class parameter tables: references/algorithms.md
  • For exact optimize_prompt signatures, prompts, tool constraints, and result usage: references/prompt_agent_workflow.md
  • For pattern examples and source-backed workflows: references/example_patterns.md

Flow

stateDiagram-v2
    [*] --> SelectObjective
    SelectObjective --> ConfigurePromptOrTools: prompt, agent, or tool objective
    SelectObjective --> ConfigureParameters: parameter objective
    ConfigurePromptOrTools --> ValidateDatasetAndControls
    ConfigureParameters --> ValidateDatasetAndControls
    ValidateDatasetAndControls --> ReportBlocked: fields, metric, or limits invalid
    ValidateDatasetAndControls --> OptimizePrompt: prompt or tool strategy
    ValidateDatasetAndControls --> OptimizeParameter: ParameterOptimizer
    OptimizePrompt --> CompareBaseline
    OptimizeParameter --> CompareBaseline
    OptimizePrompt --> ReportBlocked: run fails
    OptimizeParameter --> ReportBlocked: run fails
    CompareBaseline --> ReportRecommendations
    ReportRecommendations --> [*]
    ReportBlocked --> [*]

Version history

  1. v0.4.0 GitHub ↗
    Original release notes

    ## Install `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill agent-device-lab -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill codebase-memory-mcp -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill codex-goal-mining -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill codex-session-recovery -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill crabpot-perf-metrics -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill crawlkit -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill ghcrawl-cluster-operator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill github-airplane-mode -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill graincrawl -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill openclaw-github-dedupe -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill openclaw-pr-batch-sweep -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill operations-worktree -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill opik-integrations-auditor -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill opik-optimizer -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill org-branch-cleanup -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill semantic-slicing -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill session-done -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill technical-deslop -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill technical-documentation -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill technical-integrations -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill technical-skill-finder -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill tmux-agent-lane-orchestrator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.4.0 --skill tmux-lane-orchestrator -y` ## Delta Compared to `v0.3.0`. Changed skill paths: `skills/agent-device-lab skills/codebase-memory-mcp skills/codex-goal-mining skills/codex-session-recovery skills/crabpot-perf-metrics skills/crawlkit skills/ghcrawl-cluster-operator skills/github-airplane-mode skills/graincrawl skills/openclaw-github-dedupe skills/openclaw-pr-batch-sweep skills/operations-worktree skills/opik-integrations-auditor skills/opik-optimizer skills/org-branch-cleanup skills/semantic-slicing skills/session-done skills/technical-deslop skills/technical-documentation skills/technical-integrations skills/technical-skill-finder skills/tmux-agent-lane-orchestrator skills/tmux-lane-orchestrator`

  2. v0.3.0 GitHub ↗
    Original release notes

    ## Install `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill codebase-memory-mcp -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill codex-goal-mining -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill codex-session-recovery -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill crabpot-perf-metrics -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill crawlkit -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill ghcrawl-cluster-operator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill github-airplane-mode -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill graincrawl -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill openclaw-github-dedupe -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill openclaw-pr-batch-sweep -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill operations-worktree -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill opik-integrations-auditor -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill opik-optimizer -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill org-branch-cleanup -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill semantic-slicing -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill technical-deslop -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill technical-documentation -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill technical-integrations -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill technical-skill-finder -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill tmux-agent-lane-orchestrator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.3.0 --skill tmux-lane-orchestrator -y` ## Delta Compared to `v0.2.1`. Changed skill paths: `skills/codebase-memory-mcp skills/github-airplane-mode skills/org-branch-cleanup`

  3. v0.2.1 GitHub ↗
    Original release notes

    ## Install `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill codebase-memory-mcp -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill codex-goal-mining -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill codex-session-recovery -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill crabpot-perf-metrics -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill crawlkit -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill ghcrawl-cluster-operator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill graincrawl -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill openclaw-github-dedupe -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill openclaw-pr-batch-sweep -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill operations-worktree -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill opik-integrations-auditor -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill opik-optimizer -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill semantic-slicing -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill technical-deslop -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill technical-documentation -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill technical-integrations -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill technical-skill-finder -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill tmux-agent-lane-orchestrator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.1 --skill tmux-lane-orchestrator -y` ## Delta Compared to `v0.2.0`. Changed skill paths: `skills/openclaw-pr-batch-sweep`

  4. v0.2.0 GitHub ↗
    Original release notes

    ## Install `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill codebase-memory-mcp -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill codex-goal-mining -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill codex-session-recovery -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill crabpot-perf-metrics -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill crawlkit -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill ghcrawl-cluster-operator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill graincrawl -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill openclaw-github-dedupe -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill openclaw-pr-batch-sweep -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill operations-worktree -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill opik-integrations-auditor -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill opik-optimizer -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill semantic-slicing -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill technical-deslop -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill technical-documentation -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill technical-integrations -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill technical-skill-finder -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill tmux-agent-lane-orchestrator -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.2.0 --skill tmux-lane-orchestrator -y` ## Delta Compared to `v0.1.7`. Changed skill paths: `skills/codebase-memory-mcp skills/codex-goal-mining skills/codex-session-recovery skills/crabpot-perf-metrics skills/crawlkit skills/example-skill skills/ghcrawl-cluster-operator skills/graincrawl skills/openclaw-github-dedupe skills/openclaw-pr-batch-sweep skills/operations-worktree skills/opik-integrations-auditor skills/opik-optimizer skills/semantic-slicing skills/technical-deslop skills/technical-documentation skills/technical-integrations skills/technical-skill-finder skills/tmux-agent-lane-orchestrator skills/tmux-lane-orchestrator`

  5. v0.1.7 GitHub ↗
    Original release notes

    ## Install `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.1.7 --skill openclaw-github-dedupe -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.1.7 --skill technical-deslop -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.1.7 --skill technical-documentation -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.1.7 --skill technical-integrations -y` `npx skills add https://github.com/vincentkoc/dotskills/tree/v0.1.7 --skill technical-skill-finder -y` ## Delta Compared to `v0.1.6`. Changed skill paths: `skills/openclaw-github-dedupe`

Only the five most recent versions are shown. View full version history at the source ↗

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value75/100

Highlights

  • 提供标准化的 Opik Optimizer 工作流,解决 LLM 提示词、工具和参数调优的实际需求
  • 面向专业开发者群体,具有明确的技术应用场景和实用价值
Trigger Precision85/100

Highlights

  • When to use 章节详细列出 5 种明确触发场景,覆盖全面
  • description 完整且边界清晰,不易与其他技能混淆
Structure and Standards75/100

Areas to improve

  • 文档过长 Reported severity: Minor

    主文档超过 500 行限制(约 600+ 行),影响可读性

    Recommendation: 考虑将部分内容拆分到引用文件中,或精简重复内容

Highlights

  • Workflow 和 Core workflow 提供清晰的执行步骤
  • 包含完整的端到端代码示例和 mermaid 流程图
Execution Reliability80/100

Highlights

  • 工具来源明确,参数说明详细,覆盖主要异常情况
  • Key execution details 和 Common mistakes 提供重要执行约束和最佳实践
Evidence Verifiability (mean of the first four)79/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 57
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Not specified in the source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.