Skip to content

Commit

Permalink
v0.4.2 - Updated Models (#10)
Browse files Browse the repository at this point in the history
* Fix `partialeq` feature

There was always supposed to be an underscore.

* Fix warnings, and make warnings errors
* Update model names
  • Loading branch information
mdegans authored Oct 23, 2024
1 parent 9394432 commit 61f782b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "misanthropic"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
authors = ["Michael de Gans <[email protected]>"]
description = "An async, ergonomic, client for Anthropic's Messages API"
Expand Down Expand Up @@ -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"]

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(warnings)]
#![warn(missing_docs)]
//! `misanthropic` is a crate providing ergonomic access to the [Anthropic
//! Messages API].
Expand Down
24 changes: 19 additions & 5 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
2 changes: 0 additions & 2 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!";
Expand Down
2 changes: 1 addition & 1 deletion src/response/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 61f782b

Please sign in to comment.