diff --git a/Cargo.toml b/Cargo.toml index 982330d..5174f10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "misanthropic" -version = "0.4.1" +version = "0.4.2" edition = "2021" authors = ["Michael de Gans "] description = "An async, ergonomic, client for Anthropic's Messages API" @@ -86,7 +86,7 @@ rustls-tls = ["reqwest/rustls-tls"] # converting to CommonMark. markdown = ["dep:pulldown-cmark", "dep:pulldown-cmark-to-cmark"] # Derive PartialEq for all structs and enums. -partialeq = [] +partial_eq = [] # Input and output sanitization langsan = ["dep:langsan"] diff --git a/src/lib.rs b/src/lib.rs index 45dd16b..5b6a927 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#![deny(warnings)] #![warn(missing_docs)] //! `misanthropic` is a crate providing ergonomic access to the [Anthropic //! Messages API]. diff --git a/src/model.rs b/src/model.rs index 94ce7ab..8d8965a 100644 --- a/src/model.rs +++ b/src/model.rs @@ -16,18 +16,32 @@ use serde::{Deserialize, Serialize}; )] #[serde(rename_all = "snake_case")] pub enum Model { - /// Sonnet 3.5. - #[serde(rename = "claude-3-5-sonnet-20240620")] + /// Sonnet 3.5 (latest) + #[serde(rename = "claude-3-5-sonnet-latest")] Sonnet35, - /// Opus 3.0. - #[serde(rename = "claude-3-opus-20240229")] + /// Sonnet 3.5 2024-06-20 + #[serde(rename = "claude-3-5-sonnet-20240620")] + Sonnet35_20240620, + /// Sonnet 3.0 2024-10-22 + #[serde(rename = "claude-3-sonnet-20241022")] + Sonnet30_20241022, + /// Opus 3.0 (latest) + #[serde(rename = "claude-3-opus-latest")] Opus30, + /// Opus 3.0 2024-02-29 + #[serde(rename = "claude-3-opus-20240229")] + Opus30_20240229, /// Sonnet 3.0 #[cfg(not(feature = "prompt-caching"))] #[serde(rename = "claude-3-sonnet-20240229")] Sonnet30, - /// Haiku 3.0. This is the default model. + /// Haiku 3.0 (latest) This is the default model. #[default] + // The `latest` alias is not enabled yet, but (very likely) will be in the + // future. If not we will manually update this. #[serde(rename = "claude-3-haiku-20240307")] Haiku30, + /// Haiku 3.0 2024-03-07 + #[serde(rename = "claude-3-haiku-20240307")] + Haiku30_20240307, } diff --git a/src/response.rs b/src/response.rs index 8f6bee1..6f0bf61 100644 --- a/src/response.rs +++ b/src/response.rs @@ -119,8 +119,6 @@ impl<'a> Response<'a> { mod tests { use super::*; - use std::borrow::Cow; - const TEST_ID: &str = "test_id"; const CONTENT: &str = "Hello, world!"; diff --git a/src/response/message.rs b/src/response/message.rs index eaf412f..718ae21 100644 --- a/src/response/message.rs +++ b/src/response/message.rs @@ -141,7 +141,7 @@ mod tests { let message: Message = serde_json::from_str(RESPONSE_JSON).unwrap(); assert_eq!(message.message.content.len(), 1); assert_eq!(message.id, "msg_013Zva2CMHLNnXjNJJKqJ2EF"); - assert_eq!(message.model, crate::Model::Sonnet35); + assert_eq!(message.model, crate::Model::Sonnet35_20240620); assert!(matches!(message.stop_reason, Some(StopReason::EndTurn))); assert_eq!(message.stop_sequence, None); assert_eq!(message.usage.input_tokens, 2095);