use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
#[derive(Serialize)]
pub struct JevRequest<S: Serialize> {
pub state: S,
pub model: String,
pub questions: BTreeMap<String, Question>,
}
#[derive(Serialize)]
#[serde(tag = "type", rename_all = "lowercase")]
pub enum Question {
Noul {
instructions: String,
#[serde(skip_serializing_if = "Option::is_none")]
criteria: Option<NoulCriteria>,
},
Choice {
instructions: String,
criteria: BTreeMap<String, Option<String>>,
},
}
#[derive(Serialize)]
pub struct NoulCriteria {
#[serde(rename = "true")]
pub true_means: String,
#[serde(rename = "false")]
pub false_means: String,
}
#[derive(Deserialize)]
pub struct JevResponse {
pub model: String,
pub answers: BTreeMap<String, Answer>,
pub usage: Usage,
}
#[derive(Deserialize)]
#[serde(tag = "type", rename_all = "lowercase")]
pub enum Answer {
Noul {
noul: f64,
},
Choice {
choice: String,
confidence: Option<f64>,
probabilities: BTreeMap<String, f64>,
},
Score {
score: f64,
confidence: Option<f64>,
probabilities: BTreeMap<String, f64>,
},
}
#[derive(Deserialize)]
pub struct Usage {
pub input_tokens: u64,
pub output_tokens: u64,
}