opik-optimizer

在 Opik 中使用标准化的优化工作流(提示优化、工具优化和参数调优)、数据集/指标连接以及结果解释,优化 LLM 提示、工具和智能体。

仓库最近推送
GitHub Stars
111
Forks
9
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "opik-optimizer":https://skillpi.com/zh/skills/deepskill-b862ce3a3e1f772a88dbb69f1085b11a26f8861ea33a2bc652041ae0a6b15329。安装前核对上游来源和版本:https://github.com/vincentkoc/dotskills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

在 Opik 中使用标准化的优化工作流(提示优化、工具优化和参数调优)、数据集/指标连接以及结果解释,优化 LLM 提示、工具和智能体。

0 下载

介绍来源: third_party · vincentkoc · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
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 --> [*]

版本历史

  1. v0.4.0 GitHub ↗
    原版更新说明

    ## 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 ↗
    原版更新说明

    ## 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 ↗
    原版更新说明

    ## 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 ↗
    原版更新说明

    ## 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 ↗
    原版更新说明

    ## 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`

此处仅展示最近 5 个版本。 在原站查看完整版本历史 ↗

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值75/100

亮点

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

亮点

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

待提升项

  • 文档过长 原报告严重程度:轻微

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

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

亮点

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

亮点

  • 工具来源明确,参数说明详细,覆盖主要异常情况
  • Key execution details 和 Common mistakes 提供重要执行约束和最佳实践
证据可验 (前四项均值)79/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

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

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 57 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • github.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。