mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-23 15:48:07 +00:00
Add eq trait
This commit is contained in:
@ -6,7 +6,7 @@ use std::collections::HashMap;
|
|||||||
use crate::impl_builder_methods;
|
use crate::impl_builder_methods;
|
||||||
use crate::v1::common;
|
use crate::v1::common;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Clone)]
|
#[derive(Debug, Serialize, Clone, PartialEq, Eq)]
|
||||||
pub enum ToolChoiceType {
|
pub enum ToolChoiceType {
|
||||||
None,
|
None,
|
||||||
Auto,
|
Auto,
|
||||||
@ -89,7 +89,7 @@ impl_builder_methods!(
|
|||||||
tool_choice: ToolChoiceType
|
tool_choice: ToolChoiceType
|
||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum MessageRole {
|
pub enum MessageRole {
|
||||||
user,
|
user,
|
||||||
@ -98,7 +98,7 @@ pub enum MessageRole {
|
|||||||
function,
|
function,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone, PartialEq, Eq)]
|
||||||
pub enum Content {
|
pub enum Content {
|
||||||
Text(String),
|
Text(String),
|
||||||
ImageUrl(Vec<ImageUrl>),
|
ImageUrl(Vec<ImageUrl>),
|
||||||
@ -116,20 +116,20 @@ impl serde::Serialize for Content {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum ContentType {
|
pub enum ContentType {
|
||||||
text,
|
text,
|
||||||
image_url,
|
image_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct ImageUrlType {
|
pub struct ImageUrlType {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct ImageUrl {
|
pub struct ImageUrl {
|
||||||
pub r#type: ContentType,
|
pub r#type: ContentType,
|
||||||
@ -177,7 +177,7 @@ pub struct ChatCompletionResponse {
|
|||||||
pub system_fingerprint: Option<String>,
|
pub system_fingerprint: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
pub struct Function {
|
pub struct Function {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
@ -185,7 +185,7 @@ pub struct Function {
|
|||||||
pub parameters: FunctionParameters,
|
pub parameters: FunctionParameters,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum JSONSchemaType {
|
pub enum JSONSchemaType {
|
||||||
Object,
|
Object,
|
||||||
@ -196,7 +196,7 @@ pub enum JSONSchemaType {
|
|||||||
Boolean,
|
Boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
#[derive(Debug, Deserialize, Serialize, Clone, Default, PartialEq, Eq)]
|
||||||
pub struct JSONSchemaDefine {
|
pub struct JSONSchemaDefine {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub schema_type: Option<JSONSchemaType>,
|
pub schema_type: Option<JSONSchemaType>,
|
||||||
@ -212,7 +212,7 @@ pub struct JSONSchemaDefine {
|
|||||||
pub items: Option<Box<JSONSchemaDefine>>,
|
pub items: Option<Box<JSONSchemaDefine>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
pub struct FunctionParameters {
|
pub struct FunctionParameters {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub schema_type: JSONSchemaType,
|
pub schema_type: JSONSchemaType,
|
||||||
@ -222,7 +222,7 @@ pub struct FunctionParameters {
|
|||||||
pub required: Option<Vec<String>>,
|
pub required: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum FinishReason {
|
pub enum FinishReason {
|
||||||
stop,
|
stop,
|
||||||
@ -274,13 +274,13 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
pub struct Tool {
|
pub struct Tool {
|
||||||
pub r#type: ToolType,
|
pub r#type: ToolType,
|
||||||
pub function: Function,
|
pub function: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Copy, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Copy, Clone, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ToolType {
|
pub enum ToolType {
|
||||||
Function,
|
Function,
|
||||||
|
@ -69,7 +69,7 @@ pub struct MessageObject {
|
|||||||
pub metadata: HashMap<String, String>,
|
pub metadata: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum MessageRole {
|
pub enum MessageRole {
|
||||||
user,
|
user,
|
||||||
|
@ -50,7 +50,7 @@ pub struct Message {
|
|||||||
pub metadata: Option<HashMap<String, String>>,
|
pub metadata: Option<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub enum MessageRole {
|
pub enum MessageRole {
|
||||||
user,
|
user,
|
||||||
|
Reference in New Issue
Block a user