1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* OpenAI API
*
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.3.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// CreateEvalCustomDataSourceConfig : A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs. This schema is used to define the shape of the data that will be: - Used to define your testing criteria and - What data is required when creating a run
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct CreateEvalCustomDataSourceConfig {
/// The type of data source. Always `custom`.
#[serde(rename = "type")]
pub r#type: Type,
/// The json schema for each row in the data source.
#[serde(rename = "item_schema")]
pub item_schema: std::collections::HashMap<String, serde_json::Value>,
/// Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source)
#[serde(
rename = "include_sample_schema",
skip_serializing_if = "Option::is_none"
)]
pub include_sample_schema: Option<bool>,
}
impl CreateEvalCustomDataSourceConfig {
/// A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs. This schema is used to define the shape of the data that will be: - Used to define your testing criteria and - What data is required when creating a run
pub fn new(
r#type: Type,
item_schema: std::collections::HashMap<String, serde_json::Value>,
) -> CreateEvalCustomDataSourceConfig {
CreateEvalCustomDataSourceConfig {
r#type,
item_schema,
include_sample_schema: None,
}
}
}
/// The type of data source. Always `custom`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "custom")]
Custom,
}
impl Default for Type {
fn default() -> Type {
Self::Custom
}
}
impl std::fmt::Display for CreateEvalCustomDataSourceConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}