vincentkoc/dotskills

opik-optimizer

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.

First seen Feb 17, 2026

Installation

$ npx skills add vincentkoc/dotskills --skill opik-optimizer

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from vincentkoc/dotskills · top by installs.

npx skills add vincentkoc/dotskills

Browse all from vincentkoc/dotskills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 102
License LICENSE
Default branch main
Open issues 4
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

LicenseMIT
More metadata
source
https://github.com/vincentkoc/dotskills

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,887 B
  • docs SUMMARY.md 222 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 39 installs

SKILL.md

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 (nthreads, nsamples, 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/promptagentworkflow.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

  1. Define a single ChatPrompt (or dict of prompts for multi-prompt cases).
  2. Provide a dataset from opik_optimizer.datasets.
  3. Provide metric callable with signature (datasetitem, llmoutput) -> float (or ScoreResult/list of ScoreResult).
  4. Set optimizer controls (nthreads, nsamples, max_trials, seed, etc.).
  5. Run one of:

- optimizeprompt(...) for prompt/system behavior changes. - optimizeparameter(...) for model-call hyperparameters.

  1. Inspect OptimizationResult (score, initialscore, history, optimizationid, getoptimizedparameters).

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 nsamples and nsamples_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 optimizeprompts values and helper functions from promptsegments:

- extractpromptsegments(ChatPrompt) to inspect stable segment IDs. - applysegmentupdates(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 numthreads with nthreads.
  • 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 optimizeprompt signatures, prompts, tool constraints, and result usage: references/promptagent_workflow.md
  • For pattern examples and source-backed workflows: references/example_patterns.md