java/resources/evals/methods/retrieve/index.md +0 −414 deleted
File Deleted View Diff
1## Get an eval
2
3`EvalRetrieveResponse evals().retrieve(EvalRetrieveParamsparams = EvalRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
4
5**get** `/evals/{eval_id}`
6
7Get an evaluation by ID.
8
9### Parameters
10
11- `EvalRetrieveParams params`
12
13 - `Optional<String> evalId`
14
15### Returns
16
17- `class EvalRetrieveResponse:`
18
19 An Eval object with a data source config and testing criteria.
20 An Eval represents a task to be done for your LLM integration.
21 Like:
22
23 - Improve the quality of my chatbot
24 - See how well my chatbot handles customer support
25 - Check if o4-mini is better at my usecase than gpt-4o
26
27 - `String id`
28
29 Unique identifier for the evaluation.
30
31 - `long createdAt`
32
33 The Unix timestamp (in seconds) for when the eval was created.
34
35 - `DataSourceConfig dataSourceConfig`
36
37 Configuration of data sources used in runs of the evaluation.
38
39 - `class EvalCustomDataSourceConfig:`
40
41 A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces.
42 The response schema defines the shape of the data that will be:
43
44 - Used to define your testing criteria and
45 - What data is required when creating a run
46
47 - `Schema schema`
48
49 The json schema for the run data source items.
50 Learn how to build JSON schemas [here](https://json-schema.org/).
51
52 - `JsonValue; type "custom"constant`
53
54 The type of data source. Always `custom`.
55
56 - `CUSTOM("custom")`
57
58 - `class Logs:`
59
60 A LogsDataSourceConfig which specifies the metadata property of your logs query.
61 This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.
62 The schema returned by this data source config is used to defined what variables are available in your evals.
63 `item` and `sample` are both defined when using this data source config.
64
65 - `Schema schema`
66
67 The json schema for the run data source items.
68 Learn how to build JSON schemas [here](https://json-schema.org/).
69
70 - `JsonValue; type "logs"constant`
71
72 The type of data source. Always `logs`.
73
74 - `LOGS("logs")`
75
76 - `Optional<Metadata> metadata`
77
78 Set of 16 key-value pairs that can be attached to an object. This can be
79 useful for storing additional information about the object in a structured
80 format, and querying for objects via API or the dashboard.
81
82 Keys are strings with a maximum length of 64 characters. Values are strings
83 with a maximum length of 512 characters.
84
85 - `class EvalStoredCompletionsDataSourceConfig:`
86
87 Deprecated in favor of LogsDataSourceConfig.
88
89 - `Schema schema`
90
91 The json schema for the run data source items.
92 Learn how to build JSON schemas [here](https://json-schema.org/).
93
94 - `JsonValue; type "stored_completions"constant`
95
96 The type of data source. Always `stored_completions`.
97
98 - `STORED_COMPLETIONS("stored_completions")`
99
100 - `Optional<Metadata> metadata`
101
102 Set of 16 key-value pairs that can be attached to an object. This can be
103 useful for storing additional information about the object in a structured
104 format, and querying for objects via API or the dashboard.
105
106 Keys are strings with a maximum length of 64 characters. Values are strings
107 with a maximum length of 512 characters.
108
109 - `Optional<Metadata> metadata`
110
111 Set of 16 key-value pairs that can be attached to an object. This can be
112 useful for storing additional information about the object in a structured
113 format, and querying for objects via API or the dashboard.
114
115 Keys are strings with a maximum length of 64 characters. Values are strings
116 with a maximum length of 512 characters.
117
118 - `String name`
119
120 The name of the evaluation.
121
122 - `JsonValue; object_ "eval"constant`
123
124 The object type.
125
126 - `EVAL("eval")`
127
128 - `List<TestingCriterion> testingCriteria`
129
130 A list of testing criteria.
131
132 - `class LabelModelGrader:`
133
134 A LabelModelGrader object which uses a model to assign labels to each item
135 in the evaluation.
136
137 - `List<Input> input`
138
139 - `Content content`
140
141 Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.
142
143 - `String`
144
145 - `class ResponseInputText:`
146
147 A text input to the model.
148
149 - `String text`
150
151 The text input to the model.
152
153 - `JsonValue; type "input_text"constant`
154
155 The type of the input item. Always `input_text`.
156
157 - `INPUT_TEXT("input_text")`
158
159 - `class OutputText:`
160
161 A text output from the model.
162
163 - `String text`
164
165 The text output from the model.
166
167 - `JsonValue; type "output_text"constant`
168
169 The type of the output text. Always `output_text`.
170
171 - `OUTPUT_TEXT("output_text")`
172
173 - `class InputImage:`
174
175 An image input block used within EvalItem content arrays.
176
177 - `String imageUrl`
178
179 The URL of the image input.
180
181 - `JsonValue; type "input_image"constant`
182
183 The type of the image input. Always `input_image`.
184
185 - `INPUT_IMAGE("input_image")`
186
187 - `Optional<String> detail`
188
189 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
190
191 - `class ResponseInputAudio:`
192
193 An audio input to the model.
194
195 - `InputAudio inputAudio`
196
197 - `String data`
198
199 Base64-encoded audio data.
200
201 - `Format format`
202
203 The format of the audio data. Currently supported formats are `mp3` and
204 `wav`.
205
206 - `MP3("mp3")`
207
208 - `WAV("wav")`
209
210 - `JsonValue; type "input_audio"constant`
211
212 The type of the input item. Always `input_audio`.
213
214 - `INPUT_AUDIO("input_audio")`
215
216 - `List<EvalContentItem>`
217
218 - `String`
219
220 - `class ResponseInputText:`
221
222 A text input to the model.
223
224 - `OutputText`
225
226 - `String text`
227
228 The text output from the model.
229
230 - `JsonValue; type "output_text"constant`
231
232 The type of the output text. Always `output_text`.
233
234 - `OUTPUT_TEXT("output_text")`
235
236 - `InputImage`
237
238 - `String imageUrl`
239
240 The URL of the image input.
241
242 - `JsonValue; type "input_image"constant`
243
244 The type of the image input. Always `input_image`.
245
246 - `INPUT_IMAGE("input_image")`
247
248 - `Optional<String> detail`
249
250 The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.
251
252 - `class ResponseInputAudio:`
253
254 An audio input to the model.
255
256 - `Role role`
257
258 The role of the message input. One of `user`, `assistant`, `system`, or
259 `developer`.
260
261 - `USER("user")`
262
263 - `ASSISTANT("assistant")`
264
265 - `SYSTEM("system")`
266
267 - `DEVELOPER("developer")`
268
269 - `Optional<Type> type`
270
271 The type of the message input. Always `message`.
272
273 - `MESSAGE("message")`
274
275 - `List<String> labels`
276
277 The labels to assign to each item in the evaluation.
278
279 - `String model`
280
281 The model to use for the evaluation. Must support structured outputs.
282
283 - `String name`
284
285 The name of the grader.
286
287 - `List<String> passingLabels`
288
289 The labels that indicate a passing result. Must be a subset of labels.
290
291 - `JsonValue; type "label_model"constant`
292
293 The object type, which is always `label_model`.
294
295 - `LABEL_MODEL("label_model")`
296
297 - `class StringCheckGrader:`
298
299 A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.
300
301 - `String input`
302
303 The input text. This may include template strings.
304
305 - `String name`
306
307 The name of the grader.
308
309 - `Operation operation`
310
311 The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.
312
313 - `EQ("eq")`
314
315 - `NE("ne")`
316
317 - `LIKE("like")`
318
319 - `ILIKE("ilike")`
320
321 - `String reference`
322
323 The reference text. This may include template strings.
324
325 - `JsonValue; type "string_check"constant`
326
327 The object type, which is always `string_check`.
328
329 - `STRING_CHECK("string_check")`
330
331 - `class EvalGraderTextSimilarity:`
332
333 A TextSimilarityGrader object which grades text based on similarity metrics.
334
335 - `double passThreshold`
336
337 The threshold for the score.
338
339 - `class EvalGraderPython:`
340
341 A PythonGrader object that runs a python script on the input.
342
343 - `Optional<Double> passThreshold`
344
345 The threshold for the score.
346
347 - `class EvalGraderScoreModel:`
348
349 A ScoreModelGrader object that uses a model to assign a score to the input.
350
351 - `Optional<Double> passThreshold`
352
353 The threshold for the score.
354
355### Example
356
357```java
358package com.openai.example;
359
360import com.openai.client.OpenAIClient;
361import com.openai.client.okhttp.OpenAIOkHttpClient;
362import com.openai.models.evals.EvalRetrieveParams;
363import com.openai.models.evals.EvalRetrieveResponse;
364
365public final class Main {
366 private Main() {}
367
368 public static void main(String[] args) {
369 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
370
371 EvalRetrieveResponse eval = client.evals().retrieve("eval_id");
372 }
373}
374```
375
376#### Response
377
378```json
379{
380 "id": "id",
381 "created_at": 0,
382 "data_source_config": {
383 "schema": {
384 "foo": "bar"
385 },
386 "type": "custom"
387 },
388 "metadata": {
389 "foo": "string"
390 },
391 "name": "Chatbot effectiveness Evaluation",
392 "object": "eval",
393 "testing_criteria": [
394 {
395 "input": [
396 {
397 "content": "string",
398 "role": "user",
399 "type": "message"
400 }
401 ],
402 "labels": [
403 "string"
404 ],
405 "model": "model",
406 "name": "name",
407 "passing_labels": [
408 "string"
409 ],
410 "type": "label_model"
411 }
412 ]
413}
414```