Skip to content

Commit 3746070

Browse files
authored
Merge pull request #64 from rellfy/anthropic
Anthropic API support
2 parents 60a51a0 + 875eda0 commit 3746070

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "openai"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
authors = ["Lorenzo Fontoura <[email protected]>", "valentinegb"]
55
edition = "2021"
66
description = "An unofficial Rust library for the OpenAI API."

src/chat.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ pub type ChatCompletionDelta = ChatCompletionGeneric<ChatCompletionChoiceDelta>;
2222

2323
#[derive(Deserialize, Clone, Debug, Eq, PartialEq)]
2424
pub struct ChatCompletionGeneric<C> {
25+
#[serde(default)]
2526
pub id: String,
27+
#[serde(default)]
2628
pub object: String,
29+
#[serde(default)]
2730
pub created: u64,
31+
#[serde(default)]
2832
pub model: String,
33+
#[serde(default = "default_empty_vec")]
2934
pub choices: Vec<C>,
3035
pub usage: Option<Usage>,
3136
}
@@ -603,6 +608,10 @@ impl Default for ChatCompletionMessageRole {
603608
}
604609
}
605610

611+
fn default_empty_vec<C>() -> Vec<C> {
612+
Vec::new()
613+
}
614+
606615
#[cfg(test)]
607616
mod tests {
608617
use super::*;

0 commit comments

Comments
 (0)