@@ -41,10 +41,10 @@ import kotlin.jvm.optionals.getOrNull
41
41
42
42
/* *
43
43
* Create the structure of an evaluation that can be used to test a model's performance. An
44
- * evaluation is a set of testing criteria and a datasource. After creating an evaluation, you can
45
- * run it on different models and model parameters. We support several types of graders and
46
- * datasources. For more information, see the
47
- * [Evals guide](https://platform.openai.com/docs/guides/evals).
44
+ * evaluation is a set of testing criteria and the config for a data source, which dictates the
45
+ * schema of the data used in the evaluation. After creating an evaluation, you can run it on
46
+ * different models and model parameters. We support several types of graders and datasources. For
47
+ * more information, see the [Evals guide](https://platform.openai.com/docs/guides/evals).
48
48
*/
49
49
class EvalCreateParams
50
50
private constructor (
@@ -54,15 +54,18 @@ private constructor(
54
54
) : Params {
55
55
56
56
/* *
57
- * The configuration for the data source used for the evaluation runs.
57
+ * The configuration for the data source used for the evaluation runs. Dictates the schema of
58
+ * the data used in the evaluation.
58
59
*
59
60
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
60
61
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
61
62
*/
62
63
fun dataSourceConfig (): DataSourceConfig = body.dataSourceConfig()
63
64
64
65
/* *
65
- * A list of graders for all eval runs in this group.
66
+ * A list of graders for all eval runs in this group. Graders can reference variables in the
67
+ * data source using double curly braces notation, like `{{item.variable_name}}`. To reference
68
+ * the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`).
66
69
*
67
70
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
68
71
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
@@ -167,7 +170,10 @@ private constructor(
167
170
*/
168
171
fun body (body : Body ) = apply { this .body = body.toBuilder() }
169
172
170
- /* * The configuration for the data source used for the evaluation runs. */
173
+ /* *
174
+ * The configuration for the data source used for the evaluation runs. Dictates the schema
175
+ * of the data used in the evaluation.
176
+ */
171
177
fun dataSourceConfig (dataSourceConfig : DataSourceConfig ) = apply {
172
178
body.dataSourceConfig(dataSourceConfig)
173
179
}
@@ -207,11 +213,16 @@ private constructor(
207
213
* Alias for calling [dataSourceConfig] with
208
214
* `DataSourceConfig.ofStoredCompletions(storedCompletions)`.
209
215
*/
216
+ @Deprecated(" deprecated" )
210
217
fun dataSourceConfig (storedCompletions : DataSourceConfig .StoredCompletions ) = apply {
211
218
body.dataSourceConfig(storedCompletions)
212
219
}
213
220
214
- /* * A list of graders for all eval runs in this group. */
221
+ /* *
222
+ * A list of graders for all eval runs in this group. Graders can reference variables in the
223
+ * data source using double curly braces notation, like `{{item.variable_name}}`. To
224
+ * reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`).
225
+ */
215
226
fun testingCriteria (testingCriteria : List <TestingCriterion >) = apply {
216
227
body.testingCriteria(testingCriteria)
217
228
}
@@ -468,7 +479,8 @@ private constructor(
468
479
) : this (dataSourceConfig, testingCriteria, metadata, name, mutableMapOf ())
469
480
470
481
/* *
471
- * The configuration for the data source used for the evaluation runs.
482
+ * The configuration for the data source used for the evaluation runs. Dictates the schema
483
+ * of the data used in the evaluation.
472
484
*
473
485
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
474
486
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
@@ -477,7 +489,9 @@ private constructor(
477
489
dataSourceConfig.getRequired(" data_source_config" )
478
490
479
491
/* *
480
- * A list of graders for all eval runs in this group.
492
+ * A list of graders for all eval runs in this group. Graders can reference variables in the
493
+ * data source using double curly braces notation, like `{{item.variable_name}}`. To
494
+ * reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`).
481
495
*
482
496
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
483
497
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
@@ -584,7 +598,10 @@ private constructor(
584
598
additionalProperties = body.additionalProperties.toMutableMap()
585
599
}
586
600
587
- /* * The configuration for the data source used for the evaluation runs. */
601
+ /* *
602
+ * The configuration for the data source used for the evaluation runs. Dictates the
603
+ * schema of the data used in the evaluation.
604
+ */
588
605
fun dataSourceConfig (dataSourceConfig : DataSourceConfig ) =
589
606
dataSourceConfig(JsonField .of(dataSourceConfig))
590
607
@@ -622,10 +639,16 @@ private constructor(
622
639
* Alias for calling [dataSourceConfig] with
623
640
* `DataSourceConfig.ofStoredCompletions(storedCompletions)`.
624
641
*/
642
+ @Deprecated(" deprecated" )
625
643
fun dataSourceConfig (storedCompletions : DataSourceConfig .StoredCompletions ) =
626
644
dataSourceConfig(DataSourceConfig .ofStoredCompletions(storedCompletions))
627
645
628
- /* * A list of graders for all eval runs in this group. */
646
+ /* *
647
+ * A list of graders for all eval runs in this group. Graders can reference variables in
648
+ * the data source using double curly braces notation, like `{{item.variable_name}}`. To
649
+ * reference the model's output, use the `sample` namespace (ie,
650
+ * `{{sample.output_text}}`).
651
+ */
629
652
fun testingCriteria (testingCriteria : List <TestingCriterion >) =
630
653
testingCriteria(JsonField .of(testingCriteria))
631
654
@@ -813,7 +836,10 @@ private constructor(
813
836
" Body{dataSourceConfig=$dataSourceConfig , testingCriteria=$testingCriteria , metadata=$metadata , name=$name , additionalProperties=$additionalProperties }"
814
837
}
815
838
816
- /* * The configuration for the data source used for the evaluation runs. */
839
+ /* *
840
+ * The configuration for the data source used for the evaluation runs. Dictates the schema of
841
+ * the data used in the evaluation.
842
+ */
817
843
@JsonDeserialize(using = DataSourceConfig .Deserializer ::class )
818
844
@JsonSerialize(using = DataSourceConfig .Serializer ::class )
819
845
class DataSourceConfig
@@ -839,14 +865,15 @@ private constructor(
839
865
fun logs (): Optional <Logs > = Optional .ofNullable(logs)
840
866
841
867
/* * Deprecated in favor of LogsDataSourceConfig. */
868
+ @Deprecated(" deprecated" )
842
869
fun storedCompletions (): Optional <StoredCompletions > =
843
870
Optional .ofNullable(storedCompletions)
844
871
845
872
fun isCustom (): Boolean = custom != null
846
873
847
874
fun isLogs (): Boolean = logs != null
848
875
849
- fun isStoredCompletions (): Boolean = storedCompletions != null
876
+ @Deprecated( " deprecated " ) fun isStoredCompletions (): Boolean = storedCompletions != null
850
877
851
878
/* *
852
879
* A CustomDataSourceConfig object that defines the schema for the data source used for the
@@ -863,6 +890,7 @@ private constructor(
863
890
fun asLogs (): Logs = logs.getOrThrow(" logs" )
864
891
865
892
/* * Deprecated in favor of LogsDataSourceConfig. */
893
+ @Deprecated(" deprecated" )
866
894
fun asStoredCompletions (): StoredCompletions =
867
895
storedCompletions.getOrThrow(" storedCompletions" )
868
896
@@ -968,6 +996,7 @@ private constructor(
968
996
@JvmStatic fun ofLogs (logs : Logs ) = DataSourceConfig (logs = logs)
969
997
970
998
/* * Deprecated in favor of LogsDataSourceConfig. */
999
+ @Deprecated(" deprecated" )
971
1000
@JvmStatic
972
1001
fun ofStoredCompletions (storedCompletions : StoredCompletions ) =
973
1002
DataSourceConfig (storedCompletions = storedCompletions)
@@ -995,6 +1024,7 @@ private constructor(
995
1024
fun visitLogs (logs : Logs ): T
996
1025
997
1026
/* * Deprecated in favor of LogsDataSourceConfig. */
1027
+ @Deprecated(" deprecated" )
998
1028
fun visitStoredCompletions (storedCompletions : StoredCompletions ): T
999
1029
1000
1030
/* *
@@ -1029,7 +1059,7 @@ private constructor(
1029
1059
DataSourceConfig (logs = it, _json = json)
1030
1060
} ? : DataSourceConfig (_json = json)
1031
1061
}
1032
- " stored-completions " -> {
1062
+ " stored_completions " -> {
1033
1063
return tryDeserialize(node, jacksonTypeRef<StoredCompletions >())?.let {
1034
1064
DataSourceConfig (storedCompletions = it, _json = json)
1035
1065
} ? : DataSourceConfig (_json = json)
@@ -1726,6 +1756,7 @@ private constructor(
1726
1756
}
1727
1757
1728
1758
/* * Deprecated in favor of LogsDataSourceConfig. */
1759
+ @Deprecated(" deprecated" )
1729
1760
class StoredCompletions
1730
1761
private constructor (
1731
1762
private val type: JsonValue ,
@@ -1742,11 +1773,11 @@ private constructor(
1742
1773
) : this (type, metadata, mutableMapOf ())
1743
1774
1744
1775
/* *
1745
- * The type of data source. Always `stored-completions `.
1776
+ * The type of data source. Always `stored_completions `.
1746
1777
*
1747
1778
* Expected to always return the following:
1748
1779
* ```java
1749
- * JsonValue.from("stored-completions ")
1780
+ * JsonValue.from("stored_completions ")
1750
1781
* ```
1751
1782
*
1752
1783
* However, this method can be useful for debugging and logging (e.g. if the server
@@ -1795,7 +1826,7 @@ private constructor(
1795
1826
/* * A builder for [StoredCompletions]. */
1796
1827
class Builder internal constructor() {
1797
1828
1798
- private var type: JsonValue = JsonValue .from(" stored-completions " )
1829
+ private var type: JsonValue = JsonValue .from(" stored_completions " )
1799
1830
private var metadata: JsonField <Metadata > = JsonMissing .of()
1800
1831
private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
1801
1832
@@ -1812,7 +1843,7 @@ private constructor(
1812
1843
* It is usually unnecessary to call this method because the field defaults to the
1813
1844
* following:
1814
1845
* ```java
1815
- * JsonValue.from("stored-completions ")
1846
+ * JsonValue.from("stored_completions ")
1816
1847
* ```
1817
1848
*
1818
1849
* This method is primarily for setting the field to an undocumented or not yet
@@ -1871,7 +1902,7 @@ private constructor(
1871
1902
}
1872
1903
1873
1904
_type ().let {
1874
- if (it != JsonValue .from(" stored-completions " )) {
1905
+ if (it != JsonValue .from(" stored_completions " )) {
1875
1906
throw OpenAIInvalidDataException (" 'type' is invalid, received $it " )
1876
1907
}
1877
1908
}
@@ -1895,7 +1926,7 @@ private constructor(
1895
1926
*/
1896
1927
@JvmSynthetic
1897
1928
internal fun validity (): Int =
1898
- type.let { if (it == JsonValue .from(" stored-completions " )) 1 else 0 } +
1929
+ type.let { if (it == JsonValue .from(" stored_completions " )) 1 else 0 } +
1899
1930
(metadata.asKnown().getOrNull()?.validity() ? : 0 )
1900
1931
1901
1932
/* * Metadata filters for the stored completions data source. */
@@ -2353,7 +2384,7 @@ private constructor(
2353
2384
2354
2385
/* *
2355
2386
* A list of chat messages forming the prompt or context. May include variable
2356
- * references to the " item" namespace, ie {{item.name}}.
2387
+ * references to the ` item` namespace, ie {{item.name}}.
2357
2388
*
2358
2389
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
2359
2390
* unexpectedly missing or null (e.g. if the server responded with an unexpected
@@ -2501,7 +2532,7 @@ private constructor(
2501
2532
2502
2533
/* *
2503
2534
* A list of chat messages forming the prompt or context. May include variable
2504
- * references to the " item" namespace, ie {{item.name}}.
2535
+ * references to the ` item` namespace, ie {{item.name}}.
2505
2536
*/
2506
2537
fun input (input : List <Input >) = input(JsonField .of(input))
2507
2538
@@ -2724,7 +2755,7 @@ private constructor(
2724
2755
2725
2756
/* *
2726
2757
* A chat message that makes up the prompt or context. May include variable references
2727
- * to the " item" namespace, ie {{item.name}}.
2758
+ * to the ` item` namespace, ie {{item.name}}.
2728
2759
*/
2729
2760
@JsonDeserialize(using = Input .Deserializer ::class )
2730
2761
@JsonSerialize(using = Input .Serializer ::class )
0 commit comments