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