1use serde::{Deserialize, Serialize};
7
8pub mod chat;
9
10#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12pub struct ModelListResponse {
13 pub object: String,
14 pub data: Vec<ModelObject>,
15}
16
17impl ModelListResponse {
18 pub fn new(data: Vec<ModelObject>) -> Self {
20 Self {
21 object: "list".to_owned(),
22 data,
23 }
24 }
25}
26
27#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30pub struct ModelObject {
31 pub id: String,
32 pub object: String,
33 pub created: i64,
34 pub owned_by: String,
35 pub name: String,
36 pub info: ModelInfo,
37 pub venice: VeniceModelMetadata,
38}
39
40impl ModelObject {
41 pub fn new(
43 id: impl Into<String>,
44 created: i64,
45 owned_by: impl Into<String>,
46 capabilities: ModelCapabilities,
47 venice: VeniceModelMetadata,
48 ) -> Self {
49 let id = id.into();
50
51 Self {
52 name: id.clone(),
53 id,
54 object: "model".to_owned(),
55 created,
56 owned_by: owned_by.into(),
57 info: ModelInfo {
58 meta: ModelMeta { capabilities },
59 },
60 venice,
61 }
62 }
63}
64
65#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
67pub struct ModelInfo {
68 pub meta: ModelMeta,
69}
70
71#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
73pub struct ModelMeta {
74 pub capabilities: ModelCapabilities,
75}
76
77#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
79pub struct ModelCapabilities {
80 pub function_calling: bool,
81 pub builtin_tools: bool,
82 pub web_search: bool,
83 pub code_interpreter: bool,
84 pub vision: bool,
85 pub reasoning: bool,
86 pub reasoning_effort: bool,
87}
88
89#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
91pub struct VeniceModelMetadata {
92 pub id: String,
93 #[serde(rename = "supportsE2EE")]
94 pub supports_e2ee: bool,
95 #[serde(rename = "supportsTeeAttestation")]
96 pub supports_tee_attestation: bool,
97 #[serde(rename = "supportsReasoning")]
98 pub supports_reasoning: bool,
99 #[serde(rename = "supportsReasoningEffort")]
100 pub supports_reasoning_effort: bool,
101}
102
103impl VeniceModelMetadata {
104 pub fn new(
106 id: impl Into<String>,
107 supports_e2ee: bool,
108 supports_tee_attestation: bool,
109 supports_reasoning: bool,
110 supports_reasoning_effort: bool,
111 ) -> Self {
112 Self {
113 id: id.into(),
114 supports_e2ee,
115 supports_tee_attestation,
116 supports_reasoning,
117 supports_reasoning_effort,
118 }
119 }
120}
121
122#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
124pub struct ErrorResponse {
125 pub error: ErrorObject,
126}
127
128impl ErrorResponse {
129 pub fn new(
131 message: impl Into<String>,
132 error_type: impl Into<String>,
133 code: impl Into<String>,
134 ) -> Self {
135 Self {
136 error: ErrorObject {
137 message: message.into(),
138 kind: error_type.into(),
139 code: code.into(),
140 },
141 }
142 }
143}
144
145#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
147pub struct ErrorObject {
148 pub message: String,
149 #[serde(rename = "type")]
150 pub kind: String,
151 pub code: String,
152}