Logo Phoenix Evals New Metric

Phoenix Evals New Metric

Tổ chứcPhổ biến
Arize-ai
phoenix-evals-new-metric

Tạo trình đánh giá phân loại tích hợp mới cho Phoenix evals. Dùng kỹ năng này khi bạn muốn tạo eval mới, xây dựng metric mới, thêm trình đánh giá tích hợp, tạo metric LLM-as-a-judge hoặc thêm trình đánh giá phân loại mới vào Phoenix.

Add to TypingMind

Tổng quan

Nhà phát hànhArize-ai
Kho mãphoenix
Tên kỹ năngphoenix-evals-new-metric
Sao
11.8K
Bản fork
1.2K
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được Arize-ai công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Phoenix Evals New Metric trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/Arize-ai/phoenix/tree/main/.agents/skills/phoenix-evals-new-metric
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Arize-ai/phoenix.git /tmp/phoenix
mkdir -p .claude/skills
cp -r /tmp/phoenix/.agents/skills/phoenix-evals-new-metric .claude/skills/phoenix-evals-new-metric
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Phoenix Evals New Metric trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Phoenix Evals New Metric ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Phoenix Evals New Metric với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Creating a New Built-in Classification Evaluator

A built-in evaluator is a YAML config (source of truth) that gets compiled into Python and TypeScript code, wrapped in evaluator classes, benchmarked, and documented. The whole pipeline is linear — follow these steps in order.

Step 0: Gather Requirements

Before writing anything, clarify with the user:

  1. What does this evaluator measure? Get a one-sentence description of the quality dimension.
  2. What input data is available? This determines the template placeholders (e.g., {{input}}, {{output}}, {{reference}}, {{tool_definitions}}). If the user is vague, ask follow-up questions — the placeholders are the contract between the evaluator and the caller.
  3. What labels make sense? Binary is most common (e.g., correct/incorrect, faithful/unfaithful), but some metrics use more. Labels map to scores.
  4. Should this appear in the dataset experiments UI? If yes, it needs the promoted_dataset_evaluator label. Currently only correctness, tool_selection, and tool_invocation have this — some may new evaluators don't need it.

Step 1: Create the YAML Config

Create prompts/classification_evaluator_configs/{NAME}_CLASSIFICATION_EVALUATOR_CONFIG.yaml.

Read an existing config to match the current schema. Start with CORRECTNESS_CLASSIFICATION_EVALUATOR_CONFIG.yaml for a simple example, or TOOL_SELECTION_CLASSIFICATION_EVALUATOR_CONFIG.yaml if your evaluator needs structured span data.

Key Decision Points

choices — Maps label strings to numeric scores. For binary evaluators, use positive/negative labels (e.g., correct: 1.0 / incorrect: 0.0). The labels you pick here flow through to the Python class, TS factory, and benchmarks.

optimization_direction — Use maximize when the positive label is the desired outcome (most evaluators). Use minimize only if the metric measures something undesirable (e.g., hallucination). This affects how Phoenix displays the metric in the UI.

labels — Optional list. Add promoted_dataset_evaluator only if this evaluator should appear in the dataset experiments UI sidebar.

substitutions — Only needed if the evaluator is a promoted_dataset_evaluator and works with structured span data (tool definitions, tool calls, message arrays). These reference formatter snippets defined in prompts/formatters/server.yaml. Read that file if you need substitutions — it defines what structured data formats are available. Most evaluators that only use simple text fields (input, output, reference) don't need substitutions.

Prompt Writing Tips

  • Be explicit about what makes each label correct — the LLM judge needs a clear rubric
  • Separate concerns: if evaluating X, explicitly state you're NOT evaluating Y
  • Wrap inputs in XML-style tags (e.g., <context>, <output>) for clear data formatting
  • Tell the judge to reason before deciding — this improves accuracy
  • Use {{placeholder}} (Mustache syntax) for template variables

Step 2: Compile Prompts

bash
make codegen-prompts

This generates code in three places:

  • packages/phoenix-evals/src/phoenix/evals/__generated__/classification_evaluator_configs/ (Python)
  • src/phoenix/__generated__/classification_evaluator_configs/ (Python, server copy)
  • js/packages/phoenix-evals/src/__generated__/default_templates/ (TypeScript)

Verify the generated files look correct before moving on.

Step 3: Create the Python Evaluator

Create packages/phoenix-evals/src/phoenix/evals/metrics/{name}.py.

Read correctness.py in that directory — it's the canonical example. Your evaluator follows the same pattern: subclass ClassificationEvaluator, pull constants from the generated config, define a Pydantic input schema with fields matching your template placeholders.

After creating the file, add it to the exports in metrics/__init__.py — both the import and the __all__ list. Read the current __init__.py to see the existing pattern.

Step 4: Create the TypeScript Evaluator

Create js/packages/phoenix-evals/src/llm/create{Name}Evaluator.ts.

Read createCorrectnessEvaluator.ts — it's the canonical example. The pattern is a factory function that wraps createClassificationEvaluator with defaults from the generated config.

Then:

  1. Add the export to js/packages/phoenix-evals/src/llm/index.ts
  2. Add a vitest test under js/packages/phoenix-evals/test/llm/ — read createFaithfulnessEvaluator.test.ts there for the test pattern

Step 5: Build JS

bash
cd js && pnpm build

Fix any TypeScript errors before proceeding.

Step 6: Write the Benchmark

Create js/benchmarks/evals-benchmarks/src/{name}.eval.ts.

Read existing benchmarks in that directory to match the current patterns:

  • tool_invocation.eval.ts — multi-category analysis and aggregate metrics
  • aggregateMetrics.ts — shared macro precision/recall/F1 accumulation

Benchmark Requirements

  • 30-50 synthetic examples organized by category
  • 2-4 examples per category covering: success cases, failure modes, and edge cases
  • Accuracy evaluator that compares predicted vs expected labels
  • Failed examples printer — this is critical for debugging. For each misclassified example, print: category, input, output (truncated), expected vs actual label, and the LLM judge's explanation
  • Per-category accuracy breakdown in the output
  • For binary evaluators, a confusion matrix is helpful

The task function must return input and output text in its result so the failed examples printer has access to them.

Consider using a separate agent session for synthetic dataset generation if the examples need realistic domain-specific content — this keeps the dataset creation focused and avoids context-switching.

Step 7: Run the Benchmark

bash
# Terminal 1: Start Phoenix using the normal configured database. Do not set
# PHOENIX_WORKING_DIR unless the user explicitly requests an isolated instance.
phoenix serve

# Terminal 2: Run the benchmark
cd js
pnpm --filter evals-benchmarks... build
pnpm --filter evals-benchmarks exec vitest run \
  src/{name}.eval.ts --config phoenix.vitest.config.ts

Target >80% accuracy. If accuracy is low, look at the failed examples output to decide whether to adjust the prompt (Step 1) or the benchmark examples (Step 6). Iterate until accuracy is acceptable.

Step 8: Create Documentation

Create docs/phoenix/evaluation/pre-built-metrics/{name}.mdx.

Read faithfulness.mdx in that directory — it's the template. Follow the same section structure:

  1. Overview — when to use, what it measures
  2. Supported Levels — span/trace/session, relevant span kinds
  3. Input Requirements — required fields table
  4. Output Interpretation — labels, scores, direction
  5. Usage Examples — Python and TypeScript in tabs
  6. Using Input Mapping — lambda example if applicable
  7. Viewing/Modifying the Prompt — link to GitHub config, custom prompt usage
  8. Configuration — link to LLM config docs
  9. Using with Phoenix — links to traces and experiments docs
  10. Benchmarks — "Coming soon" placeholder (until benchmark results are published)
  11. API Reference — links to Python and TypeScript API docs
  12. Related — links to related evaluators

Navigation Updates

After creating the docs page, update these three files:

  1. docs.json — add the page to the Evaluation > Pre-built Metrics nav group
  2. docs/phoenix/evaluation/pre-built-metrics.mdx — add a card to the landing page grid
  3. docs/phoenix/sitemap.xml — add the new URL

Read each file to see the existing pattern before editing.

Checklist

Before calling it done, verify:

  • YAML config created with clear rubric and appropriate labels/choices
  • make codegen-prompts ran successfully
  • Python evaluator class with input schema matching template placeholders
  • Python exports updated in metrics/__init__.py
  • TypeScript evaluator factory with types
  • TypeScript export added to llm/index.ts
  • Vitest test for TypeScript evaluator
  • JS packages rebuilt (cd js && pnpm build)
  • Benchmark with 30-50 examples, category breakdown, failed examples printer
  • Benchmark accuracy >80%
  • Documentation page following the template structure
  • docs.json nav updated
  • Landing page card added
  • Sitemap updated

Retrospection

After completing the workflow, verify these instructions matched reality:

  • Did any file paths, export patterns, or command names change from what's described here?
  • Did the YAML config schema gain or lose fields since this was written?
  • Did the benchmark or docs patterns evolve from the referenced examples?
  • Did make codegen-prompts generate to different locations?

If anything drifted, update this SKILL.md before finishing so the next person (or agent) doesn't hit the same surprises.

Câu hỏi thường gặp

Kỹ năng AI Phoenix Evals New Metric làm được gì?

Tạo trình đánh giá phân loại tích hợp mới cho Phoenix evals. Dùng kỹ năng này khi bạn muốn tạo eval mới, xây dựng metric mới, thêm trình đánh giá tích hợp, tạo metric LLM-as-a-judge hoặc thêm trình đánh giá phân loại mới vào Phoenix.

Vì sao nên dùng Phoenix Evals New Metric trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Phoenix Evals New Metric là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Phoenix Evals New Metric trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Arize-ai/phoenix/tree/main/.agents/skills/phoenix-evals-new-metric. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Phoenix Evals New Metric?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Phoenix Evals New Metric với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Phoenix Evals New Metric với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Phoenix Evals New Metric có miễn phí không?

Có. Kỹ năng này được Arize-ai phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇