diff --git a/CHANGELOG.md b/CHANGELOG.md index fd77ce0..cf2a84a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Add the `Claude 3 Haiku` model. +- Support `tokio::stream` for streaming API by optional. + +## [0.3.0] - 2024-03-14 + +### Added + +- Add the Claude 3 Haiku model: `claude-3-haiku-20240307`. ## [0.2.0] - 2024-03-13 @@ -27,7 +33,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add the `Create a Message` API. -[unreleased]: https://github.com/mochi-neko/clust/compare/v0.2.0...HEAD +[unreleased]: https://github.com/mochi-neko/clust/compare/v0.3.0...HEAD + +[0.3.0]: https://github.com/mochi-neko/clust/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/mochi-neko/clust/compare/v0.1.0...v0.2.0 diff --git a/Cargo.toml b/Cargo.toml index 1f88cf1..2d0f9fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clust" -version = "0.2.0" +version = "0.3.0" edition = "2021" authors = ["Mochineko "] rust-version = "1.76" diff --git a/README.md b/README.md index e08f564..72966bf 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ or add the following line to your Cargo.toml: ```toml [dependencies] -clust = "0.2.0" +clust = "0.3.0" ``` ## Supported APIs diff --git a/examples/create_a_message.rs b/examples/create_a_message.rs index c1b9be3..af7369f 100644 --- a/examples/create_a_message.rs +++ b/examples/create_a_message.rs @@ -35,7 +35,7 @@ async fn main() -> anyhow::Result<()> { let client = Client::from_env()?; // 2. Create a request body. - let model = ClaudeModel::Claude3Sonnet20240229; + let model = ClaudeModel::Claude3Haiku20240307; let messages = vec![Message::user( arguments.message, )]; diff --git a/src/messages/claude_model.rs b/src/messages/claude_model.rs index 59a9f08..ce9a2f9 100644 --- a/src/messages/claude_model.rs +++ b/src/messages/claude_model.rs @@ -13,7 +13,8 @@ pub enum ClaudeModel { /// Claude 3 Sonnet at 2024/02/29. Claude3Sonnet20240229, // Claude 3 Haiku - // Coming soon + /// Claude 3 Haiku at 2024/03/07. + Claude3Haiku20240307, } impl Default for ClaudeModel { @@ -34,6 +35,9 @@ impl Display for ClaudeModel { | ClaudeModel::Claude3Sonnet20240229 => { write!(f, "claude-3-sonnet-20240229") }, + | ClaudeModel::Claude3Haiku20240307 => { + write!(f, "claude-3-haiku-20240307") + }, } } } @@ -43,6 +47,7 @@ impl ClaudeModel { match self { | ClaudeModel::Claude3Opus20240229 => 4096, | ClaudeModel::Claude3Sonnet20240229 => 4096, + | ClaudeModel::Claude3Haiku20240307 => 4096, } } } @@ -50,7 +55,8 @@ impl ClaudeModel { impl_enum_string_serialization!( ClaudeModel, Claude3Opus20240229 => "claude-3-opus-20240229", - Claude3Sonnet20240229 => "claude-3-sonnet-20240229" + Claude3Sonnet20240229 => "claude-3-sonnet-20240229", + Claude3Haiku20240307 => "claude-3-haiku-20240307" ); #[cfg(test)] @@ -75,6 +81,10 @@ mod tests { ClaudeModel::Claude3Sonnet20240229.to_string(), "claude-3-sonnet-20240229" ); + assert_eq!( + ClaudeModel::Claude3Haiku20240307.to_string(), + "claude-3-haiku-20240307" + ); } #[test] @@ -87,6 +97,10 @@ mod tests { ClaudeModel::Claude3Sonnet20240229.max_tokens(), 4096 ); + assert_eq!( + ClaudeModel::Claude3Haiku20240307.max_tokens(), + 4096 + ); } #[test] @@ -101,6 +115,11 @@ mod tests { .unwrap(), ClaudeModel::Claude3Sonnet20240229 ); + assert_eq!( + serde_json::from_str::("\"claude-3-haiku-20240307\"") + .unwrap(), + ClaudeModel::Claude3Haiku20240307 + ); } #[test] @@ -113,5 +132,9 @@ mod tests { serde_json::to_string(&ClaudeModel::Claude3Sonnet20240229).unwrap(), "\"claude-3-sonnet-20240229\"" ); + assert_eq!( + serde_json::to_string(&ClaudeModel::Claude3Haiku20240307).unwrap(), + "\"claude-3-haiku-20240307\"" + ); } }