From c1cec985e135e664ad5b3c788977b1d9a1e84a80 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Mon, 2 Jun 2025 22:48:05 +1000 Subject: [PATCH 1/2] feat: athropic support --- src/chat.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/chat.rs b/src/chat.rs index 5d423d2..aeba4ca 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -22,10 +22,15 @@ pub type ChatCompletionDelta = ChatCompletionGeneric; #[derive(Deserialize, Clone, Debug, Eq, PartialEq)] pub struct ChatCompletionGeneric { + #[serde(default)] pub id: String, + #[serde(default)] pub object: String, + #[serde(default)] pub created: u64, + #[serde(default)] pub model: String, + #[serde(default = "default_empty_vec")] pub choices: Vec, pub usage: Option, } @@ -603,6 +608,10 @@ impl Default for ChatCompletionMessageRole { } } +fn default_empty_vec() -> Vec { + Vec::new() +} + #[cfg(test)] mod tests { use super::*; From 875eda068b4fe7ee0de27a1c694c352263f9e6b9 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Mon, 2 Jun 2025 22:54:34 +1000 Subject: [PATCH 2/2] chore: bump patch --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 25ae499..75cb547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openai" -version = "1.1.0" +version = "1.1.1" authors = ["Lorenzo Fontoura ", "valentinegb"] edition = "2021" description = "An unofficial Rust library for the OpenAI API."