From 8c0f76920aec1530f02f3a31740f1ba9fc228ccb Mon Sep 17 00:00:00 2001
From: Jackson Chen <jacksontw92@gmail.com>
Date: Thu, 24 Oct 2024 11:59:58 +0900
Subject: [PATCH] [fix-readme-example-for-structure-rename] fix readme example
 for structure rename

---
 README.md                    |  4 ++--
 src/messages/claude_model.rs | 30 +++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 1a3df33..f5cec29 100644
--- a/README.md
+++ b/README.md
@@ -424,7 +424,7 @@ use clust::messages::Message;
 use clust::messages::MessagesRequestBody;
 use clust::messages::SystemPrompt;
 use clust::messages::StreamOption;
-use clust::messages::StreamChunk;
+use clust::messages::MessageChunk;
 use clust::Client;
 
 use tokio_stream::StreamExt;
@@ -464,7 +464,7 @@ async fn main() -> anyhow::Result<()> {
             | Ok(chunk) => {
                 println!("Chunk:\n{}", chunk);
                 match chunk {
-                    | StreamChunk::ContentBlockDelta(content_block_delta) => {
+                    | MessageChunk::ContentBlockDelta(content_block_delta) => {
                         // Buffer message delta.
                         buffer.push_str(&content_block_delta.delta.text);
                     }
diff --git a/src/messages/claude_model.rs b/src/messages/claude_model.rs
index b49dfb1..2583948 100644
--- a/src/messages/claude_model.rs
+++ b/src/messages/claude_model.rs
@@ -18,6 +18,9 @@ pub enum ClaudeModel {
     // Claude 3.5 Sonnet
     /// Claude 3.5 Sonnet at 2024/06/20
     Claude35Sonnet20240620,
+    // Claude 3.5 Sonnet
+    /// Claude 3.5 Sonnet at 2024/06/22
+    Claude35Sonnet20241022,
 }
 
 impl Default for ClaudeModel {
@@ -44,6 +47,9 @@ impl Display for ClaudeModel {
             | ClaudeModel::Claude35Sonnet20240620 => {
                 write!(f, "claude-3-5-sonnet-20240620")
             },
+            | ClaudeModel::Claude35Sonnet20241022 => {
+                write!(f, "claude-3-5-sonnet-20241022")
+            },
         }
     }
 }
@@ -55,6 +61,7 @@ impl ClaudeModel {
             | ClaudeModel::Claude3Sonnet20240229 => 4096,
             | ClaudeModel::Claude3Haiku20240307 => 4096,
             | ClaudeModel::Claude35Sonnet20240620 => 4096,
+            | ClaudeModel::Claude35Sonnet20241022 => 4096,
         }
     }
 }
@@ -64,7 +71,8 @@ impl_enum_string_serialization!(
     Claude3Opus20240229 => "claude-3-opus-20240229",
     Claude3Sonnet20240229 => "claude-3-sonnet-20240229",
     Claude3Haiku20240307 => "claude-3-haiku-20240307",
-    Claude35Sonnet20240620 => "claude-3-5-sonnet-20240620"
+    Claude35Sonnet20240620 => "claude-3-5-sonnet-20240620",
+    Claude35Sonnet20241022 => "claude-3-5-sonnet-20241022"
 );
 
 #[cfg(test)]
@@ -97,6 +105,10 @@ mod tests {
             ClaudeModel::Claude35Sonnet20240620.to_string(),
             "claude-3-5-sonnet-20240620"
         );
+        assert_eq!(
+            ClaudeModel::Claude3Sonnet20241022.to_string(),
+            "claude-3-5-sonnet-20241022"
+        )
     }
 
     #[test]
@@ -117,6 +129,10 @@ mod tests {
             ClaudeModel::Claude35Sonnet20240620.max_tokens(),
             4096
         );
+        assert_eq!(
+            ClaudeModel::Claude3Sonnet20241022.max_tokens(),
+            4096
+        );
     }
 
     #[test]
@@ -143,6 +159,13 @@ mod tests {
             .unwrap(),
             ClaudeModel::Claude35Sonnet20240620
         );
+        assert_eq!(
+            serde_json::from_str::<ClaudeModel>(
+                "\"claude-3-5-sonnet-20241022\""
+            )
+            .unwrap(),
+            ClaudeModel::Claude3Sonnet20241022
+        );
     }
 
     #[test]
@@ -164,5 +187,10 @@ mod tests {
                 .unwrap(),
             "\"claude-3-5-sonnet-20240620\""
         );
+        assert_eq!(
+            serde_json::to_string(&ClaudeModel::Claude3Sonnet20241022)
+                .unwrap(),
+            "\"claude-3-5-sonnet-20241022\""
+        );
     }
 }