Important
本文中標示為預覽的項目目前仍在預覽中。 此預覽版未簽訂服務等級協議,Microsoft 不建議用於生產工作負載。 某些功能可能不被支援或功能受限。 欲了解更多資訊,請參閱 Microsoft Azure 預覽版補充使用條款。
對於您想要託管與控制的自訂評分邏輯,請使用端點式評估器。 它可以在評分過程中擷取外部來源,重複使用您組織已使用的評估服務或評分 API,並執行簡單或複雜的自訂邏輯。 若要自訂 LLM 作為評審評分,請使用 評分標準評估器。 關於現有的程式碼基礎或提示式自訂評估器,請參閱 其他自訂評估器。
端點式評估器會將評分委派給你擁有並操作的外部 HTTP 端點。 評估服務會呼叫您的每個項目端點,並將可用的評估器資料以 JSON 負載傳遞。 您的端點會處理資料並回傳帶有評估結果的 JSON 回應。 由於邏輯運行於你控制的基礎架構上,不受適用於程式碼評估器的程式碼沙盒限制。
使用 SDK、REST API 或 Foundry 入口網站註冊端點式評估器。 本文展示 Python SDK 與入口網站的使用體驗。
何時使用
使用端點式評估器,針對您想在自身基礎架構上開發、測試、部署及操作的自訂評分邏輯。 其邏輯可以從簡單的規則式檢查到複雜的評估流程不等。 常見情況包括:
- 您希望獨立版本化並部署的簡單或複雜評分邏輯。
- 評分依賴評估者在執行時必須存取的外部資料來源、內部服務或資料庫。
- 與貴組織已擁有或使用的評估服務或評分 API 整合。
運作原理
- 你部署一個 HTTP 端點,接受帶有評估資料的 POST 請求。
- 使用 SDK、REST API 或 Foundry 入口網站,您可以在 Foundry 專案中建立一個連線,用來儲存端點 URL 和驗證憑證。
- 使用 SDK、REST API 或 Foundry 入口網站,您可以註冊一個端點式評估器,該評估器會參考該連線。 設定
schema_version0.0.2評估者使用建議的請求與回應合約。 - 當評估執行時,服務會解決連線,呼叫你的端點並輸入資料,並將回應記錄為評估結果。
開始之前
在建置範例端點並註冊評估器之前,請完成以下設定。
Azure Functions 導覽
安裝支援的 Python 版本及 Azure Functions Core Tools。 在本機和你部署的函式應用程式中使用相同的 Python 主修和副修版本。 要部署範例,你還需要在 Azure 中使用一個 Python 函式應用程式。 如果您沒有,請完成 Azure Functions 命令列快速啟動。
SDK 範例
本文中的 SDK 範例假設您已建立專案用戶端。
安裝 SDK 並設定您的客戶端一次,然後重複使用、、credentialproject_client,並在client以下範例中重複使用endpoint:
pip install "azure-ai-projects>=2.11.0" azure-identity \
azure-mgmt-cognitiveservices openai
import os
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
# Foundry project endpoint
# Example:
# https://<account_name>.services.ai.azure.com/api/projects/<project_name>
endpoint = os.environ["FOUNDRY_PROJECT_ENDPOINT"]
credential = DefaultAzureCredential()
# Create the project client
project_client = AIProjectClient(endpoint=endpoint, credential=credential)
# Get the OpenAI client for evaluation API
client = project_client.get_openai_client()
Note
註冊端點式評估器也需要上述 azure-mgmt-cognitiveservices 指令中包含的套件。 請參閱 「註冊評估員」。
使用 Azure Functions 建立端點
您的評估端點可在任何接受 POST 請求並回傳 JSON 的 HTTP 服務上執行。 使用符合您現有開發與營運實務的主機平台。 本文以 Azure Functions 作為範例。
端點必須在評估服務逾時(120 秒)內回應,並對每個請求回傳有效的 JSON 回應。
以下範例在 Azure Functions 中建立一個 Python 函式,用來檢查助理是否以文字回答結束已計分的訊息。 在回合層級評估中,它只計分最新回合。 在對話層級評估中,它會評分整個對話內容。 它也會計算工具呼叫次數,並回傳逐維度的分解。 它會驗證 Foundry 在標頭中傳送 api-key 的 API 金鑰。 請參閱端 點接收內容 及 「了解端點輸出 」以取得欄位描述。
此範例使用 API 金鑰來減少設定,並讓第一次執行專注於評估者合約。 在正式環境中,建議使用 Microsoft Entra ID 驗證。 Microsoft Entra ID 需要額外的端點驗證、令牌受眾及身份授權設定。
建立函式專案
建立專案資料夾與 Python 虛擬環境:
mkdir custom-evaluator-function
cd custom-evaluator-function
python -m venv .venv
使用您 shell 的指令啟用虛擬環境:
| Shell | 命令 |
|---|---|
| Bash | source .venv/bin/activate |
| 命令提示符 | .venv\Scripts\activate |
| PowerShell | .venv\Scripts\Activate.ps1 |
接著初始化 Python v2 專案,建立 HTTP 觸發器,並安裝其相依關係:
func init --worker-runtime python --model V2
func new --name evaluate --template "HTTP trigger" --authlevel anonymous
python -m pip install -r requirements.txt
觸發器使用匿名 Azure Functions 授權,因為範例處理程序會驗證 api-key Foundry 所傳送的標頭。 在沒有 API 金鑰驗證或其他驗證機制的情況下,不要部署匿名觸發器。
確認包含 requirements.txt Azure Functions 套件:
azure-functions
實作評估器
範例實作了結構版本 0.0.2,即建議的端點合約。 它期望評估指標定義一個閾值。 Foundry 會在每個端點請求中包含已註冊的閾值。
註冊範例將其設定為 3。
將產生的內容 function_app.py 替換為以下程式碼:
import hmac
import json
import os
import azure.functions as func
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)
def json_response(body: dict, status_code: int = 200) -> func.HttpResponse:
"""Return a JSON HTTP response."""
return func.HttpResponse(
json.dumps(body),
mimetype="application/json",
status_code=status_code,
)
def error_response(code: str, message: str, status_code: int) -> func.HttpResponse:
"""Return an endpoint error that Foundry records for the item."""
return json_response(
{"error": {"code": code, "message": message}},
status_code,
)
def message_text(message: dict) -> str:
"""Join the text parts of one message."""
parts = message.get("content", [])
return " ".join(
part.get("text", "")
for part in parts
if isinstance(part, dict) and part.get("type") == "text"
)
@app.route(route="evaluate", methods=["POST"])
def evaluate(req: func.HttpRequest) -> func.HttpResponse:
"""Score one Foundry evaluation item."""
expected_key = os.environ.get("EVALUATOR_API_KEY")
supplied_key = req.headers.get("api-key")
if not expected_key or not supplied_key:
return error_response("401", "Unauthorized", 401)
if not hmac.compare_digest(expected_key, supplied_key):
return error_response("401", "Unauthorized", 401)
try:
payload = req.get_json()
except ValueError:
return error_response("400", "Request body must be valid JSON", 400)
if not isinstance(payload, dict) or payload.get("schema_version") != "0.0.2":
return error_response("400", "Expected schema_version 0.0.2", 400)
threshold = payload.get("threshold")
if isinstance(threshold, bool) or not isinstance(threshold, (int, float)):
return error_response("400", "threshold must be a number", 400)
messages = payload.get("messages", [])
target = payload.get("evaluation_target", {})
if target.get("type") == "last_turn":
messages = messages[target["response_start_index"]:]
assistant_messages = [
message for message in messages if message.get("role") == "assistant"
]
if not assistant_messages:
return json_response(
{"status": "skipped", "reason": "No assistant messages to score."}
)
tool_calls = sum(
1
for message in assistant_messages
for part in message.get("content", [])
if isinstance(part, dict) and part.get("type") == "tool_call"
)
# A tool-call preamble isn't a final answer, even if it includes text.
final = assistant_messages[-1]
final_calls_tool = any(
isinstance(part, dict) and part.get("type") == "tool_call"
for part in final.get("content", [])
)
has_answer = bool(message_text(final).strip()) and not final_calls_tool
score = 5 if has_answer else 1
reason = (
"The assistant ends with a text answer."
if has_answer
else "The assistant doesn't end with a text answer."
)
return json_response(
{
"status": "completed",
"score": score,
"passed": score >= threshold,
"reason": reason,
"properties": {
"tool_call_count": tool_calls,
"dimension_scores": [
{"id": "final_answer", "score": score, "reason": reason},
],
},
}
)
參考資料:Azure Functions Python 開發者參考
此函數僅讀取頂層 messages 與 evaluation_target 欄位。 Foundry 為每個情境都採用相同格式建置 messages ,因此同一套程式碼會評分資料集列、代理目標、追蹤與模擬。
在本機測試函式
設定EVALUATOR_API_KEY為隨機生成的秘密。local.settings.json
將它加入產生 Values 的物件中:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python",
"EVALUATOR_API_KEY": "<API_KEY>"
}
}
不要提交這個檔案或秘密。 Azure Functions 本機設定指引說明如何儲存本機設定。
從本機啟動函式:
func start
在另一個終端機中,傳送範例評估器請求。 將 <API_KEY> 替換為 EVALUATOR_API_KEY 的值:
curl -X POST http://localhost:7071/api/evaluate \
-H "Content-Type: application/json" \
-H "api-key: <API_KEY>" \
-d '{
"schema_version": "0.0.2",
"evaluator_name": "my-endpoint-evaluator",
"evaluator_version": "1",
"evaluation_target": {"type": "last_turn", "response_start_index": 1},
"context": {},
"messages": [
{
"role": "user",
"content": [{"type": "text", "text": "I forgot my password."}]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Use the password-reset link on the sign-in page."
}
]
}
],
"agent_definition": {"tool_definitions": []},
"metadata": {"run_type": "dataset"},
"threshold": 3
}'
該函數回傳及格分數:
{
"status": "completed",
"score": 5,
"passed": true,
"reason": "The assistant ends with a text answer.",
"properties": {
"tool_call_count": 0,
"dimension_scores": [
{
"id": "final_answer",
"score": 5,
"reason": "The assistant ends with a text answer."
}
]
}
}
部署此功能
將專案發佈到您現有的功能應用程式中:
func azure functionapp publish <FUNCTION_APP_NAME>
在已部署的功能應用程式中,將設定為 EVALUATOR_API_KEY 應用程式設定。 例如:
az functionapp config appsettings set \
--name <FUNCTION_APP_NAME> \
--resource-group <RESOURCE_GROUP> \
--settings EVALUATOR_API_KEY=<API_KEY>
建立專案連線時請使用相同的密鑰ENDPOINT_API_KEY。
將 ENDPOINT_URL 設定為 https://<FUNCTION_APP_NAME>.azurewebsites.net/api/evaluate。
端點接收到的內容
評估服務會針對每個評估項目發送一個 POST 請求。 在結構版本 0.0.2中,每個請求都使用相同的形狀,無論項目來自資料集、代理或模型目標、追蹤或模擬。
要求信封
| Field | 類型 | Description |
|---|---|---|
schema_version |
string |
一律為 "0.0.2"。 |
evaluator_name |
string |
被執行的評估員註冊名稱。 |
evaluator_version |
string |
評估者定義的版本。 |
evaluation_target |
object |
該得分什麼。 請參閱 評估目標。 |
messages |
array |
要評估的對話,已標準化為單一訊息格式。 請參閱 「訊息格式」。 |
agent_definition |
object |
包含 tool_definitions代理程式可用的工具。 當沒有工具套用時,陣列為空。 |
context |
object |
原始輸入列,未變更,適用於資料集、模型目標及代理程式目標執行。 使用它來閱讀額外的欄位,例如 ground_truth。 追蹤、模擬和儲存回應執行沒有輸入列,因此 context 不包含輸入列。 |
metadata |
object |
包含識別碼,並在可用時包含 、 trace_idagent_versionspan_idagent_nameconversation_id及 。response_idrun_type |
threshold |
number |
已註冊的通過或不通過門檻。 當評估指標定義為 1 時,就會出現。 |
context 且 messages 可以包含兩種形式的相同對話。
context 保持你提交的那一列。
messages 持有 Foundry 為計分而正規化的版本。 分數來自 messages。
metadata.run_type是其中dataset之一 、 model_target、 agent_target、 agent_traceagent_simulation、 或 stored_response。
結構版本 0.0.2 會 data_mapping忽略 。 Foundry 會 messages 自動根據您的資料建構:
- 欄位
messages會被用作對話。 -
query欄位response則成為使用者訊息與助理訊息。 - 對於模型與代理目標,產生的輸出(包括工具呼叫與工具結果)會附加在輸入之後。
評估目標
evaluation_target.type 告訴您的端點要評分的哪一部分 messages :
| 類型 | 時間 | Fields |
|---|---|---|
last_turn |
轉彎層級評估 |
response_start_index:被評分回應起始的指數 messages 。 較早的訊息是對話記錄。 |
conversation |
對話層級評估 | None. 全部得分 messages。 |
例如,如果 response_start_index 是1messages[0],則是使用者的問題,而 messages[1:] 是得分的答案。
郵件格式
每個訊息的 rolesystemuser、 、 assistant或 tool,且content總是由多個部分組成的陣列:
| 零件類型 | Fields | 出現於 |
|---|---|---|
text |
text |
任何角色。 |
tool_call |
tool_call_id、name、arguments |
assistant 訊息。 |
tool_result |
tool_result |
tool 訊息。 訊息中也有一個頂層 tool_call_id。 |
請提供範例
以下範例是真實請求的精簡版本。
資料集列包含 query 和 response 欄位。 Foundry 會將它們轉換為訊息,並將原始資料列傳入 context。
{
"schema_version": "0.0.2",
"evaluator_name": "my-endpoint-evaluator",
"evaluator_version": "1",
"evaluation_target": {"type": "last_turn", "response_start_index": 1},
"context": {
"query": "What is 2 plus 2?",
"response": "2 plus 2 equals 4.",
"ground_truth": "4"
},
"messages": [
{
"role": "user",
"content": [{"type": "text", "text": "What is 2 plus 2?"}]
},
{
"role": "assistant",
"content": [{"type": "text", "text": "2 plus 2 equals 4."}]
}
],
"agent_definition": {"tool_definitions": []},
"metadata": {"run_type": "dataset"},
"threshold": 3
}
了解端點輸出
對於 HTTP 200 回應,回傳包含下列欄位的 JSON 物件:
| Field | 類型 | Required | Description |
|---|---|---|---|
status |
string |
Yes |
"completed"、"skipped" 或 "error"。 |
score |
number |
什麼時候 completed |
必須在已註冊的指標範圍內。 指標必須是整數 ordinal 。 省略 和 skippederror。 |
passed |
boolean |
什麼時候 completed |
項目是否通過。 省略 和 skippederror。 |
reason |
string |
No | 關於比分、跳過或錯誤的說明。 |
label |
string |
No | 一個簡短的結果標籤,例如 "pass" 或 "needs_review"。 |
properties |
object |
No | 評估者專屬資料。 可以包含 dimension_scores。 |
usage |
object |
No | 代幣使用方式,可選 prompt_tokens為 、 completion_tokens、 和 total_tokens 為非負整數。 |
model |
string |
No | 您的端點所使用的模型(如果有的話)。 |
Foundry 拒絕包含任何其他頂層欄位的回覆。 被拒絕的回應會被記錄為該項目的錯誤。
Foundry 並非 passed 源自 score。 請使用 threshold 請求中的 來計算 passed。 在註冊評估器時設定該門檻 EvaluatorMetric 值。
維度分數
若要回報細分,請加入 properties.dimension_scores,一個維度陣列:
| Field | 類型 | Description |
|---|---|---|
id |
string |
唯一且非空的維度識別碼。 |
score |
integer 或 null |
分數介於 1 到 5,或 null 當該維度未被評分時。 |
reason |
string |
維度分數的說明。 |
結果 completed 至少需要一個評分維度。 每個維度分數都必須使用null結果skipped。 結果中略去dimension_scoreserror。
已完成回應
{
"status": "completed",
"score": 4,
"passed": true,
"reason": "The answer is correct and cites the policy.",
"properties": {
"dimension_scores": [
{
"id": "accuracy",
"score": 5,
"reason": "The answer matches the policy."
},
{
"id": "citation",
"score": 3,
"reason": "The policy is cited without a link."
}
]
}
}
跳過回應
當項目不適用於您的評估者時,請返回 skipped :
{
"status": "skipped",
"reason": "No assistant messages to score."
}
錯誤回應
如果端點無法產生結果,請回傳帶有 error 物件的非 200 HTTP 狀態。 Foundry 會記錄該評估項目的錯誤:
{
"error": {
"code": "500",
"message": "Model inference failed"
}
}
當 Foundry 無法為該項目建立有效請求時,也會在不呼叫您的端點的情況下記錄該項目的錯誤。 例如,若資料集列 messages 的值不是有效的訊息清單,則會出現錯誤。 其他項目仍在評估中。
結構版本 0.0.1
如果端點式評估器未設定 schema_version,Foundry 會使用結構版本 0.0.1。 它仍然受到支援,但 0.0.2 用於新評估者。 版本 0.0.2 為每種情境傳送一種標準化訊息格式,並更嚴格地驗證回應。
主要差異:
| 區域 | 0.0.1 |
0.0.2 |
|---|---|---|
| 輸入欄位 | 情境特定欄位, data.item例如 query、 output_text、 output_items、 messages或 ,加 data.sample |
標準化 messages後,原始列在 context |
| Level |
evaluation_level: "turn" 或 "conversation" |
evaluation_target 其中 last_turn 和 response_start_index,或 conversation |
| 工具與元資料 | 混入 data.item |
agent_definition.tool_definitions 以及 metadata |
data_mapping |
Supported | 已忽略 |
| 回應狀態 |
"Completed"、 "Skipped",或 "Error" |
"completed"、 "skipped",或 "error" |
| 回應欄位 |
score、passed、status、reason、properties、schema_version |
嚴格欄位清單,加上 label、 usage、 model、 dimension_scores |
設定認證
端點式評估器透過專案連線支援兩種認證方法:
| 方法 | 運作原理 | 最適合用於 |
|---|---|---|
| API 金鑰 | 服務在呼叫端點時會透過請求標頭傳遞金鑰。 | 驗證api-key標頭的端點,包括本文中的 Azure Functions 範例。 |
| Microsoft Entra 身份識別 | 該服務會取得一個針對您的應用程式註冊範圍的管理身份權杖,並將其作為承載權杖傳入請求 Authorization 標頭中。 |
Azure Functions with role-based access control, Azure Functions with Easy Auth. |
註冊評估員
建立端點式評估器需要兩個步驟:建立一個專案連線,用來儲存您的端點 URL 和憑證,然後註冊一個參考該連線的評估器。 分頁顯示 Python SDK 與 Foundry 入口網站。 關於 REST API,請參閱 建立評估器版本。
此外FOUNDRY_PROJECT_ENDPOINT,還將 、 AZURE_SUBSCRIPTION_IDAZURE_RESOURCE_GROUP、 ENDPOINT_URL、 ENDPOINT_API_KEY 作為環境變數。 以下範例建立 API 金鑰連線,並對其註冊評估器:
from azure.ai.projects.models import (
EndpointBasedEvaluatorDefinition,
EndpointEvaluatorSchemaVersion,
EvaluationLevel,
EvaluatorCategory,
EvaluatorMetric,
EvaluatorType,
EvaluatorVersion,
)
from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient
from azure.mgmt.cognitiveservices.models import (
ApiKeyAuthConnectionProperties,
ConnectionApiKey,
ConnectionPropertiesV2BasicResource,
)
import os
from urllib.parse import urlparse
subscription_id = os.environ["AZURE_SUBSCRIPTION_ID"]
resource_group = os.environ["AZURE_RESOURCE_GROUP"]
endpoint_url = os.environ["ENDPOINT_URL"]
endpoint_api_key = os.environ["ENDPOINT_API_KEY"]
hostname = urlparse(endpoint).hostname
if hostname is None:
raise ValueError(f"Invalid Foundry project endpoint: {endpoint}")
account_name = hostname.split(".")[0]
# Create the connection that stores the endpoint URL and API key.
mgmt_client = CognitiveServicesManagementClient(
credential=credential,
subscription_id=subscription_id,
)
connection = ConnectionPropertiesV2BasicResource(
properties=ApiKeyAuthConnectionProperties(
category="ApiKey",
target=endpoint_url,
credentials=ConnectionApiKey(key=endpoint_api_key),
),
)
mgmt_client.account_connections.create(
resource_group_name=resource_group,
account_name=account_name,
connection_name="my-endpoint-connection",
connection=connection,
)
# Define the evaluator
evaluator_definition = EndpointBasedEvaluatorDefinition(
connection_name="my-endpoint-connection",
# Use the recommended endpoint contract. Without this, Foundry uses 0.0.1.
schema_version=EndpointEvaluatorSchemaVersion.V0_0_2,
metrics={
"score": EvaluatorMetric(
type="ordinal",
min_value=1,
max_value=5,
threshold=3,
),
},
)
# Register an evaluator that references the connection
endpoint_evaluator = project_client.evaluators.create_version(
name="my-endpoint-evaluator",
evaluator_version=EvaluatorVersion(
categories=[EvaluatorCategory.QUALITY],
evaluator_type=EvaluatorType.CUSTOM,
display_name="My Endpoint Evaluator",
description="Scores responses using a custom evaluation endpoint",
supported_evaluation_levels=[
EvaluationLevel.TURN,
EvaluationLevel.CONVERSATION,
],
definition=evaluator_definition,
),
# Custom evaluator definitions are in preview and require this opt-in header.
headers={"Foundry-Features": "Evaluations=V1Preview"},
)
使用 REST API,在物件中definition設定"schema_version": "0.0.2"並傳送標頭。Foundry-Features: Evaluations=V1Preview
評估 0.0.2 器必須定義一個型別 ordinal 為 或 continuous的指標。
對於 Microsoft Entra ID 驗證,請使用 AADAuthTypeConnectionProperties 代替 ApiKeyAuthConnectionProperties,並設定您的端點以驗證傳入的承載憑證(例如 Azure App 服務 Easy Auth)。 使用 Entra ID 時,Foundry 會傳送承載權杖而非api-key標頭,因此本文函式會以 401 拒絕請求。 將函式的 API 金鑰檢查改為持有憑證驗證。 只有在 Easy Auth 或其他層驗證 token 並授權呼叫者之後,才移除檢查。
進行評估
一旦您的端點式評估器註冊完成,即可透過 SDK、REST API 或 Foundry 入口網站進行評估。 這些分頁顯示 Python SDK 與入口網站的使用體驗。
此範例評估包含 query、 response、 document及 ground_truth 欄位的資料集列。 Foundry 會 queryresponsemessages 將 轉換為 ,並將整列傳入 context,如 端點所接收的資料集回合範例所示。
data_mapping不需要。 以下程式碼定義 input_item、 testing_criteria,以及 data_source_config,然後建立一個評估與一次執行。
from openai.types.eval_create_params import DataSourceConfigCustom
from openai.types.evals.create_eval_jsonl_run_data_source_param import (
CreateEvalJSONLRunDataSourceParam,
SourceFileContent,
SourceFileContentContent,
)
input_item = {
"query": "I can't sign in to my account.",
"response": "Use the password-reset link on the sign-in page.",
"document": "Account sign-in help article.",
"ground_truth": "Use the password-reset link.",
}
testing_criteria = [
{
"type": "azure_ai_evaluator",
"name": "endpoint_eval",
"evaluator_name": "my-endpoint-evaluator",
},
]
data_source_config = DataSourceConfigCustom(
type="custom",
item_schema={
"type": "object",
"properties": {
"query": {"type": "string"},
"response": {"type": "string"},
"document": {"type": "string"},
"ground_truth": {"type": "string"},
},
"required": ["query", "response"],
},
)
eval_object = client.evals.create(
name="endpoint-evaluator-test",
data_source_config=data_source_config,
testing_criteria=testing_criteria,
)
eval_run = client.evals.runs.create(
eval_id=eval_object.id,
name="endpoint-evaluator-run",
data_source=CreateEvalJSONLRunDataSourceParam(
type="jsonl",
source=SourceFileContent(
type="file_content",
content=[
SourceFileContentContent(
item=input_item,
),
],
),
),
extra_body={"evaluation_level": "turn"},
)
print(f"Run started: {eval_run.id}")
在對話層級的執行中,每個項目都需要完整的對話,而非僅僅 query 和 response。 在每個項目中提供一個 messages 陣列,加入 messages , item_schema並設定 evaluation_level 為 "conversation"extra_body。 Foundry 接著會 evaluation_target 傳送 類型 conversation。 關於資料格式,請參閱 評估對話資料集。
若要評估代理程式或模型目標,或追蹤,請參閱「 在雲端評估模型與代理 程式」及 「從 SDK 執行評估」。
端點在每種情況下都會收到相同的請求形狀。
有關輪詢、結果、取消與疑難排解,請參閱 「取得雲端評估結果」。 完整的執行與清理生命週期,請參閱端點評估器 Python 範例。
清理
完成測試後,請刪除您為本文建立的資源,以免它們繼續產生成本或保持可存取狀態:評估、評估器版本、儲存端點憑證的連線,以及如果您不再需要的託管端點本身。 完整的清理程式碼請參閱端點評估器 Python 範例。