|
| 1 | +use super::{common, types}; |
1 | 2 | use crate::impl_builder_methods; |
2 | | -use crate::v1::common; |
| 3 | + |
3 | 4 | use serde::de::{self, MapAccess, SeqAccess, Visitor}; |
4 | 5 | use serde::ser::SerializeMap; |
5 | 6 | use serde::{Deserialize, Deserializer, Serialize, Serializer}; |
@@ -185,6 +186,7 @@ impl<'de> Deserialize<'de> for Content { |
185 | 186 | deserializer.deserialize_any(ContentVisitor) |
186 | 187 | } |
187 | 188 | } |
| 189 | + |
188 | 190 | #[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] |
189 | 191 | #[allow(non_camel_case_types)] |
190 | 192 | pub enum ContentType { |
@@ -251,51 +253,6 @@ pub struct ChatCompletionResponse { |
251 | 253 | pub headers: Option<HashMap<String, String>>, |
252 | 254 | } |
253 | 255 |
|
254 | | -#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] |
255 | | -pub struct Function { |
256 | | - pub name: String, |
257 | | - #[serde(skip_serializing_if = "Option::is_none")] |
258 | | - pub description: Option<String>, |
259 | | - pub parameters: FunctionParameters, |
260 | | -} |
261 | | - |
262 | | -#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] |
263 | | -#[serde(rename_all = "lowercase")] |
264 | | -pub enum JSONSchemaType { |
265 | | - Object, |
266 | | - Number, |
267 | | - String, |
268 | | - Array, |
269 | | - Null, |
270 | | - Boolean, |
271 | | -} |
272 | | - |
273 | | -#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialEq, Eq)] |
274 | | -pub struct JSONSchemaDefine { |
275 | | - #[serde(rename = "type")] |
276 | | - pub schema_type: Option<JSONSchemaType>, |
277 | | - #[serde(skip_serializing_if = "Option::is_none")] |
278 | | - pub description: Option<String>, |
279 | | - #[serde(skip_serializing_if = "Option::is_none")] |
280 | | - pub enum_values: Option<Vec<String>>, |
281 | | - #[serde(skip_serializing_if = "Option::is_none")] |
282 | | - pub properties: Option<HashMap<String, Box<JSONSchemaDefine>>>, |
283 | | - #[serde(skip_serializing_if = "Option::is_none")] |
284 | | - pub required: Option<Vec<String>>, |
285 | | - #[serde(skip_serializing_if = "Option::is_none")] |
286 | | - pub items: Option<Box<JSONSchemaDefine>>, |
287 | | -} |
288 | | - |
289 | | -#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] |
290 | | -pub struct FunctionParameters { |
291 | | - #[serde(rename = "type")] |
292 | | - pub schema_type: JSONSchemaType, |
293 | | - #[serde(skip_serializing_if = "Option::is_none")] |
294 | | - pub properties: Option<HashMap<String, Box<JSONSchemaDefine>>>, |
295 | | - #[serde(skip_serializing_if = "Option::is_none")] |
296 | | - pub required: Option<Vec<String>>, |
297 | | -} |
298 | | - |
299 | 256 | #[derive(Debug, Deserialize, Serialize, PartialEq, Eq)] |
300 | 257 | #[allow(non_camel_case_types)] |
301 | 258 | pub enum FinishReason { |
@@ -352,7 +309,7 @@ where |
352 | 309 | #[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] |
353 | 310 | pub struct Tool { |
354 | 311 | pub r#type: ToolType, |
355 | | - pub function: Function, |
| 312 | + pub function: types::Function, |
356 | 313 | } |
357 | 314 |
|
358 | 315 | #[derive(Debug, Deserialize, Serialize, Copy, Clone, PartialEq, Eq)] |
|
0 commit comments