mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
Add serialize
This commit is contained in:
@ -69,7 +69,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
Some(chat_completion::FinishReason::tool_calls) => {
|
||||
println!("ToolCalls");
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
struct Currency {
|
||||
coin: String,
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
Some(chat_completion::FinishReason::tool_calls) => {
|
||||
println!("ToolCalls");
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
struct Currency {
|
||||
coin: String,
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ impl_builder_methods!(
|
||||
metadata: HashMap<String, String>
|
||||
);
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct AssistantObject {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
@ -61,14 +61,14 @@ pub struct AssistantObject {
|
||||
pub metadata: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct DeletionStatus {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
pub deleted: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ListAssistant {
|
||||
pub object: String,
|
||||
pub data: Vec<AssistantObject>,
|
||||
@ -79,7 +79,7 @@ pub struct AssistantFileRequest {
|
||||
pub file_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct AssistantFileObject {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
@ -87,7 +87,7 @@ pub struct AssistantFileObject {
|
||||
pub assistant_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ListAssistantFile {
|
||||
pub object: String,
|
||||
pub data: Vec<AssistantFileObject>,
|
||||
|
@ -39,7 +39,7 @@ impl_builder_methods!(
|
||||
language: String
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct AudioTranscriptionResponse {
|
||||
pub text: String,
|
||||
}
|
||||
@ -75,7 +75,7 @@ impl_builder_methods!(
|
||||
temperature: f32
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct AudioTranslationResponse {
|
||||
pub text: String,
|
||||
}
|
||||
@ -111,7 +111,7 @@ impl AudioSpeechRequest {
|
||||
|
||||
impl_builder_methods!(AudioSpeechRequest,);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct AudioSpeechResponse {
|
||||
pub result: bool,
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ impl_builder_methods!(
|
||||
tool_choice: ToolChoiceType
|
||||
);
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum MessageRole {
|
||||
user,
|
||||
@ -116,20 +116,20 @@ impl serde::Serialize for Content {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum ContentType {
|
||||
text,
|
||||
image_url,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct ImageUrlType {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct ImageUrl {
|
||||
pub r#type: ContentType,
|
||||
@ -139,7 +139,7 @@ pub struct ImageUrl {
|
||||
pub image_url: Option<ImageUrlType>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct ChatCompletionMessage {
|
||||
pub role: MessageRole,
|
||||
pub content: Content,
|
||||
@ -147,7 +147,7 @@ pub struct ChatCompletionMessage {
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ChatCompletionMessageForResponse {
|
||||
pub role: MessageRole,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@ -177,7 +177,7 @@ pub struct ChatCompletionResponse {
|
||||
pub system_fingerprint: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct Function {
|
||||
pub name: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@ -185,7 +185,7 @@ pub struct Function {
|
||||
pub parameters: FunctionParameters,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum JSONSchemaType {
|
||||
Object,
|
||||
@ -196,7 +196,7 @@ pub enum JSONSchemaType {
|
||||
Boolean,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||
pub struct JSONSchemaDefine {
|
||||
#[serde(rename = "type")]
|
||||
pub schema_type: Option<JSONSchemaType>,
|
||||
@ -212,7 +212,7 @@ pub struct JSONSchemaDefine {
|
||||
pub items: Option<Box<JSONSchemaDefine>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct FunctionParameters {
|
||||
#[serde(rename = "type")]
|
||||
pub schema_type: JSONSchemaType,
|
||||
@ -222,7 +222,7 @@ pub struct FunctionParameters {
|
||||
pub required: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum FinishReason {
|
||||
stop,
|
||||
@ -232,21 +232,21 @@ pub enum FinishReason {
|
||||
null,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct FinishDetails {
|
||||
pub r#type: FinishReason,
|
||||
pub stop: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct ToolCall {
|
||||
pub id: String,
|
||||
pub r#type: String,
|
||||
pub function: ToolCallFunction,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct ToolCallFunction {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<String>,
|
||||
@ -274,13 +274,13 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct Tool {
|
||||
pub r#type: ToolType,
|
||||
pub function: Function,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Copy, Clone)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ToolType {
|
||||
Function,
|
||||
|
@ -93,7 +93,7 @@ impl_builder_methods!(
|
||||
user: String
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct CompletionChoice {
|
||||
pub text: String,
|
||||
pub index: i64,
|
||||
@ -101,7 +101,7 @@ pub struct CompletionChoice {
|
||||
pub logprobs: Option<LogprobResult>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct LogprobResult {
|
||||
pub tokens: Vec<String>,
|
||||
pub token_logprobs: Vec<f32>,
|
||||
@ -109,7 +109,7 @@ pub struct LogprobResult {
|
||||
pub text_offset: Vec<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct CompletionResponse {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
|
@ -39,13 +39,13 @@ impl_builder_methods!(
|
||||
top_p: f32
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct EditChoice {
|
||||
pub text: String,
|
||||
pub index: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct EditResponse {
|
||||
pub object: String,
|
||||
pub created: i64,
|
||||
|
@ -3,7 +3,7 @@ use std::option::Option;
|
||||
|
||||
use crate::impl_builder_methods;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct EmbeddingData {
|
||||
pub object: String,
|
||||
pub embedding: Vec<f32>,
|
||||
@ -33,7 +33,7 @@ impl_builder_methods!(
|
||||
user: String
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct EmbeddingResponse {
|
||||
pub object: String,
|
||||
pub data: Vec<EmbeddingData>,
|
||||
@ -41,7 +41,7 @@ pub struct EmbeddingResponse {
|
||||
pub usage: Usage,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Usage {
|
||||
pub prompt_tokens: i32,
|
||||
pub total_tokens: i32,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FileData {
|
||||
pub id: String,
|
||||
pub oejct: String,
|
||||
@ -10,7 +10,7 @@ pub struct FileData {
|
||||
pub purpose: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FileListResponse {
|
||||
pub object: String,
|
||||
pub data: Vec<FileData>,
|
||||
@ -28,7 +28,7 @@ impl FileUploadRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FileUploadResponse {
|
||||
pub id: String,
|
||||
pub oejct: String,
|
||||
@ -49,7 +49,7 @@ impl FileDeleteRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FileDeleteResponse {
|
||||
pub id: String,
|
||||
pub oejct: String,
|
||||
@ -67,7 +67,7 @@ impl FileRetrieveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FileRetrieveResponse {
|
||||
pub id: String,
|
||||
pub oejct: String,
|
||||
@ -88,7 +88,7 @@ impl FileRetrieveContentRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FileRetrieveContentResponse {
|
||||
pub id: String,
|
||||
pub oejct: String,
|
||||
|
@ -93,14 +93,14 @@ impl CancelFineTuningJobRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FineTuningPagination<T> {
|
||||
pub object: String,
|
||||
pub data: Vec<T>,
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FineTuningJobObject {
|
||||
pub id: String,
|
||||
pub created_at: i64,
|
||||
@ -118,14 +118,14 @@ pub struct FineTuningJobObject {
|
||||
pub validation_file: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FineTuningJobError {
|
||||
pub code: String,
|
||||
pub message: String,
|
||||
pub param: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct FineTuningJobEvent {
|
||||
pub id: String,
|
||||
pub created_at: i64,
|
||||
@ -134,7 +134,7 @@ pub struct FineTuningJobEvent {
|
||||
pub object: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct HyperParameters {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub batch_size: Option<String>,
|
||||
|
@ -3,7 +3,7 @@ use std::option::Option;
|
||||
|
||||
use crate::impl_builder_methods;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ImageData {
|
||||
pub url: String,
|
||||
}
|
||||
@ -45,7 +45,7 @@ impl_builder_methods!(
|
||||
user: String
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ImageGenerationResponse {
|
||||
pub created: i64,
|
||||
pub data: Vec<ImageData>,
|
||||
@ -94,7 +94,7 @@ impl_builder_methods!(
|
||||
user: String
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ImageEditResponse {
|
||||
pub created: i64,
|
||||
pub data: Vec<ImageData>,
|
||||
@ -137,7 +137,7 @@ impl_builder_methods!(
|
||||
user: String
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ImageVariationResponse {
|
||||
pub created: i64,
|
||||
pub data: Vec<ImageData>,
|
||||
|
@ -53,7 +53,7 @@ impl_builder_methods!(
|
||||
metadata: HashMap<String, String>
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct MessageObject {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
@ -69,7 +69,7 @@ pub struct MessageObject {
|
||||
pub metadata: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum MessageRole {
|
||||
user,
|
||||
@ -78,20 +78,20 @@ pub enum MessageRole {
|
||||
function,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Content {
|
||||
#[serde(rename = "type")]
|
||||
pub content_type: String,
|
||||
pub text: ContentText,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ContentText {
|
||||
pub value: String,
|
||||
pub annotations: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ListMessage {
|
||||
pub object: String,
|
||||
pub data: Vec<MessageObject>,
|
||||
@ -100,7 +100,7 @@ pub struct ListMessage {
|
||||
pub has_more: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct MessageFileObject {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
@ -108,7 +108,7 @@ pub struct MessageFileObject {
|
||||
pub message_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ListMessageFile {
|
||||
pub object: String,
|
||||
pub data: Vec<MessageFileObject>,
|
||||
|
@ -20,21 +20,21 @@ impl_builder_methods!(
|
||||
model: String
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct CreateModerationResponse {
|
||||
pub id: String,
|
||||
pub model: String,
|
||||
pub results: Vec<ModerationResult>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ModerationResult {
|
||||
pub categories: ModerationCategories,
|
||||
pub category_scores: ModerationCategoryScores,
|
||||
pub flagged: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ModerationCategories {
|
||||
#[serde(rename = "hate")]
|
||||
pub is_hate: bool,
|
||||
@ -50,7 +50,7 @@ pub struct ModerationCategories {
|
||||
pub is_violence_graphic: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ModerationCategoryScores {
|
||||
#[serde(rename = "hate")]
|
||||
pub hate_score: f64,
|
||||
|
@ -60,7 +60,7 @@ impl_builder_methods!(
|
||||
metadata: HashMap<String, String>
|
||||
);
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct RunObject {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
@ -89,7 +89,7 @@ pub struct RunObject {
|
||||
pub metadata: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ListRun {
|
||||
pub object: String,
|
||||
pub data: Vec<RunObject>,
|
||||
@ -113,7 +113,7 @@ pub struct CreateThreadAndRunRequest {
|
||||
pub metadata: Option<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct RunStepObject {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
@ -140,7 +140,7 @@ pub struct RunStepObject {
|
||||
pub metadata: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct ListRunStep {
|
||||
pub object: String,
|
||||
pub data: Vec<RunStepObject>,
|
||||
|
@ -32,7 +32,7 @@ impl_builder_methods!(
|
||||
metadata: HashMap<String, String>
|
||||
);
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ThreadObject {
|
||||
pub id: String,
|
||||
pub object: String,
|
||||
@ -40,7 +40,7 @@ pub struct ThreadObject {
|
||||
pub metadata: HashMap<String, String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct Message {
|
||||
pub role: MessageRole,
|
||||
pub content: String,
|
||||
@ -50,7 +50,7 @@ pub struct Message {
|
||||
pub metadata: Option<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum MessageRole {
|
||||
user,
|
||||
|
Reference in New Issue
Block a user