アライズ・フェニックスの得点者
Arize Phoenixは、Arize AIが開発したオープンソースのLLM(論理言語管理)の可観測性および評価フレームワークです。MLflowはPhoenixと統合されているため、幻覚検出、関連性評価、毒性識別などのタスクにおいて、Phoenixの評価ツールをスコアラーとして使用できます。
要件
arize-phoenix-evalsパッケージをインストールしてください。
Python
%pip install arize-phoenix-evals
クイックスタート
フェニックスのスコアラーに直接電話するには:
Python
from mlflow.genai.scorers.phoenix import Hallucination
scorer = Hallucination(model="databricks:/databricks-gpt-5-mini")
feedback = scorer(
inputs="What is the capital of France?",
outputs="Paris is the capital of France.",
expectations={"context": "France is a country in Europe. Its capital is Paris."},
)
print(feedback.value) # "factual" or "hallucinated"
print(feedback.metadata["score"]) # Numeric score
mlflow.genai.evaluate()を使用してフェニックスのスコアラーを呼び出すには:
Python
import mlflow
from mlflow.genai.scorers.phoenix import Hallucination, Relevance
eval_dataset = [
{
"inputs": {"query": "What is MLflow?"},
"outputs": "MLflow is an open-source AI engineering platform for agents and LLMs.",
"expectations": {
"context": "MLflow is an ML platform for experiment tracking and model deployment."
},
},
{
"inputs": {"query": "How do I track experiments?"},
"outputs": "You can use mlflow.start_run() to begin tracking experiments.",
"expectations": {
"context": "MLflow provides APIs like mlflow.start_run() for experiment tracking."
},
},
]
results = mlflow.genai.evaluate(
data=eval_dataset,
scorers=[
Hallucination(model="databricks:/databricks-gpt-5-mini"),
Relevance(model="databricks:/databricks-gpt-5-mini"),
],
)
フェニックスの得点可能な選手
スコアラー | それは何を評価するのですか? |
|---|---|
出力には、文脈から欠落した捏造情報が含まれていますか? | |
取得したコンテキストは、入力クエリに関連していますか? | |
出力物には有毒物質や有害物質が含まれていますか? | |
その回答は、参照資料に対して正確ですか? | |
要約は正確かつ完全ですか? |
名前でスコアラーを作成する
メトリクス名を文字列として渡すことで、 get_scorerを使用してスコアラーを動的に作成できます。
Python
from mlflow.genai.scorers.phoenix import get_scorer
scorer = get_scorer(
metric_name="Hallucination",
model="databricks:/databricks-gpt-5-mini",
)
feedback = scorer(
inputs="What is MLflow?",
outputs="MLflow is a platform for ML workflows.",
expectations={"context": "MLflow is an ML platform."},
)