Evals
Get an evaluation
Retrieves an evaluation, including its data source configuration and testing criteria.
路徑參數
eval_id
string
必要
The identifier of the evaluation to retrieve.
回覆
The request has succeeded.
主體
object
enum
必要
The object type.
id
string
必要
Unique identifier for the evaluation.
name
string
必要
The name of the evaluation.
data_source_config
OpenAI.CreateEvalCustomDataSourceConfig | OpenAI.CreateEvalLogsDataSourceConfig | OpenAI.CreateEvalStoredCompletionsDataSourceConfig | AzureAIDataSourceConfig | AzureAIBenchmarkDataSourceConfig
必要
Configuration of data sources used in runs of the evaluation.
type
enum
必要
The type of data source. Always custom.
item_schema
object
必要
The json schema for each row in the data source.
include_sample_schema
boolean
Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source)
type
enum
必要
The type of data source. Always logs.
metadata
object
Metadata filters for the logs data source.
type
enum
必要
The type of data source. Always stored_completions.
metadata
object
Metadata filters for the stored completions data source.
benchmark_preview
AzureAIBenchmarkDataSourceConfig
Data source configuration for benchmark evaluations.
scenario
enum
必要
Data schema scenario, always benchmark for benchmark evaluations.
benchmark_name
string | enum
必要
The set of available benchmark specifications.
enum
benchmark_version
string
The version of the benchmark specification (e.g., '0.1'). Latest version if not specified.
grader_model
string
Optional grader model for benchmarks that use model graders, Required when the benchmark's testing_criteria uses a model grader type.
scenario
enum
必要
Data schema scenario, always benchmark for benchmark evaluations.
benchmark_name
string | enum
必要
The set of available benchmark specifications.
enum
benchmark_version
string
The version of the benchmark specification (e.g., '0.1'). Latest version if not specified.
grader_model
string
Optional grader model for benchmarks that use model graders, Required when the benchmark's testing_criteria uses a model grader type.
testing_criteria
(OpenAI.EvalGraderLabelModel | OpenAI.EvalGraderStringCheck | OpenAI.EvalGraderTextSimilarity | OpenAI.EvalGraderPython | OpenAI.EvalGraderScoreModel | TestingCriterionAzureAIEvaluator | EvalGraderInspectAI)[]
必要
A list of testing criteria.
created_at
integer
必要
The Unix timestamp (in seconds) for when the eval was created.
metadata
OpenAI.Metadata | null
必要
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
created_by
string
The name of the person who created the evaluation.
properties
object
Set of immutable 16 key-value pairs that can be attached to an object for storing additional information. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
Request
curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json"
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
eval = client.evals.retrieve(
"eval_id",
)
print(eval.id)
import OpenAI from "openai";
const openai = new OpenAI();
const evalObj = await openai.evals.retrieve("eval_67abd54d9b0081909a86353f6fb9317a");
console.log(evalObj);
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const _eval = await client.evals.retrieve('eval_id');
console.log(_eval.id);
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.evals.EvalRetrieveParams;
import com.openai.models.evals.EvalRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
EvalRetrieveResponse eval = client.evals().retrieve("eval_id");
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
eval_ = openai.evals.retrieve("eval_id")
puts(eval_)
回應
{
"object": "eval",
"id": "eval_67abd54d9b0081909a86353f6fb9317a",
"data_source_config": {
"type": "custom",
"schema": {
"type": "object",
"properties": {
"item": {
"type": "object",
"properties": {
"input": {
"type": "string"
},
"ground_truth": {
"type": "string"
}
},
"required": [
"input",
"ground_truth"
]
}
},
"required": [
"item"
]
}
},
"testing_criteria": [
{
"name": "String check",
"id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2",
"type": "string_check",
"input": "{{item.input}}",
"reference": "{{item.ground_truth}}",
"operation": "eq"
}
],
"name": "External Data Eval",
"created_at": 1739314509,
"metadata": {},
}