1use serde::{Deserialize, Serialize};
3use serde_json::Value;
4use std::collections::BTreeMap;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Request {
10 pub state: Value,
12 pub questions: Box<serde_json::value::RawValue>,
15}
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(tag = "type", rename_all = "lowercase")]
20pub enum Question {
21 Choice {
22 instructions: Value,
23 criteria: BTreeMap<String, Option<Value>>,
24 },
25 Score {
26 instructions: Value,
27 criteria: Vec<Value>,
28 },
29 Noul {
30 instructions: Value,
31 #[serde(skip_serializing_if = "Option::is_none")]
32 criteria: Option<BTreeMap<String, Value>>,
33 },
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(tag = "type", rename_all = "lowercase")]
39pub enum Answer {
40 Choice {
41 choice: String,
42 probabilities: BTreeMap<String, f64>,
43 confidence: f64,
44 },
45 Score {
46 score: f64,
47 probabilities: BTreeMap<String, f64>,
48 legend: BTreeMap<String, Value>,
49 confidence: f64,
50 },
51 Noul {
52 noul: f64,
53 },
54}
55
56pub use rig_core::completion::Usage;
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61pub struct Response {
62 pub model: String,
64 pub answers: Box<serde_json::value::RawValue>,
66 #[serde(default)]
67 pub usage: Option<Usage>,
69 #[serde(skip)]
70 pub provider_request_id: Option<String>,
72 #[serde(skip)]
73 pub raw: Value,
75}