From 6e0c0654af6a7daebac541995e4f082bae4a052e Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Wed, 1 Jan 2025 00:48:25 -0600
Subject: [PATCH 1/3] feat: add missing model identifiers
- Added additional identifiers for existing Models
but included the date for consistency while maintaining
backwards compatibility for those using the existing
identifiers.
- Added missing identifiers for new versions of the
Models
- Added identifiers for the models supporting the
`latest` identifier
- All identifiers sourced from this doc:
https://docs.anthropic.com/en/docs/about-claude/models
---
src/AnthropicClient/Models/AnthropicModels.cs | 70 +++++++++++++++++--
1 file changed, 65 insertions(+), 5 deletions(-)
diff --git a/src/AnthropicClient/Models/AnthropicModels.cs b/src/AnthropicClient/Models/AnthropicModels.cs
index 8fb437b..b09ee2f 100644
--- a/src/AnthropicClient/Models/AnthropicModels.cs
+++ b/src/AnthropicClient/Models/AnthropicModels.cs
@@ -6,24 +6,84 @@ namespace AnthropicClient.Models;
public static class AnthropicModels
{
///
- /// The Claude-3 Opus model.
+ /// The Claude 3 Opus model.
///
public const string Claude3Opus = "claude-3-opus-20240229";
///
- /// The Claude-3 Sonnet model.
+ /// The Claude 3 Opus model.
+ ///
+ public const string Claude3Opus20241022 = "claude-3-opus-20240229";
+
+ ///
+ /// The Claude 3 Opus model.
+ ///
+ public const string Claude3OpusLatest = "claude-3-opus-latest";
+
+ ///
+ /// The Claude 3 Sonnet model.
///
public const string Claude3Sonnet = "claude-3-sonnet-20240229";
///
- /// The Claude-3.5 Sonnet model.
+ /// The Claude 3 Sonnet model.
+ ///
+ public const string Claude3Sonnet20240229 = "claude-3-sonnet-20240229";
+
+ ///
+ /// The Claude 3.5 Sonnet model.
///
public const string Claude35Sonnet = "claude-3-5-sonnet-20240620";
///
- /// The Claude-3 Haiku model.
+ /// The Claude 3.5 Sonnet model.
+ ///
+ public const string Claude35Sonnet20240620 = "claude-3-5-sonnet-20240620";
+
+ ///
+ /// The Claude 3.5 Sonnet model.
+ ///
+ public const string Claude35Sonnet20241022 = "claude-3-5-sonnet-20241022";
+
+ ///
+ /// The Claude 3.5 Sonnet model.
+ ///
+ public const string Claude35SonnetLatest = "claude-3-5-sonnet-latest";
+
+ ///
+ /// The Claude 3 Haiku model.
///
public const string Claude3Haiku = "claude-3-haiku-20240307";
- internal static bool IsValidModel(string modelId) => modelId is Claude3Opus or Claude3Sonnet or Claude35Sonnet or Claude3Haiku;
+ ///
+ /// The Claude 3 Haiku model.
+ ///
+ public const string Claude3Haiku20240307 = "claude-3-haiku-20240307";
+
+ ///
+ /// The Claude 3.5 Haiku model.
+ ///
+ public const string Claude35Haiku20241022 = "claude-3-5-haiku-20241022";
+
+ ///
+ /// The Claude 3.5 Haiku model.
+ ///
+ public const string Claude35HaikuLatest = "claude-3-5-haiku-latest";
+
+ internal static bool IsValidModel(string modelId) => modelId is
+ Claude3Opus or
+ Claude3Opus20241022 or
+ Claude3OpusLatest or
+
+ Claude3Sonnet or
+ Claude3Sonnet20240229 or
+ Claude35Sonnet or
+ Claude35Sonnet20240620 or
+ Claude35Sonnet20241022 or
+ Claude35SonnetLatest or
+
+ Claude3Haiku or
+ Claude3Haiku20240307 or
+ Claude35Haiku20241022 or
+ Claude35HaikuLatest;
}
\ No newline at end of file
From f8611555510872adade9128a3f6737e7c69a0b28 Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Wed, 1 Jan 2025 18:46:49 -0600
Subject: [PATCH 2/3] tests: add tests for new model identifiers
---
.../Unit/Models/AnthropicModelsTests.cs | 91 ++++++++++++++++++-
1 file changed, 88 insertions(+), 3 deletions(-)
diff --git a/tests/AnthropicClient.Tests/Unit/Models/AnthropicModelsTests.cs b/tests/AnthropicClient.Tests/Unit/Models/AnthropicModelsTests.cs
index c28c358..396edbd 100644
--- a/tests/AnthropicClient.Tests/Unit/Models/AnthropicModelsTests.cs
+++ b/tests/AnthropicClient.Tests/Unit/Models/AnthropicModelsTests.cs
@@ -12,6 +12,26 @@ public class AnthropicModelsTests
actual.Should().Be(expected);
}
+ [Fact]
+ public void Claude3Opus20241022_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-opus-20240229";
+
+ var actual = AnthropicModels.Claude3Opus20241022;
+
+ actual.Should().Be(expected);
+ }
+
+ [Fact]
+ public void Claude3OpusLatest_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-opus-latest";
+
+ var actual = AnthropicModels.Claude3OpusLatest;
+
+ actual.Should().Be(expected);
+ }
+
[Fact]
public void Claude3Sonnet_WhenCalled_ItShouldReturnExpectedValue()
{
@@ -22,6 +42,16 @@ public class AnthropicModelsTests
actual.Should().Be(expected);
}
+ [Fact]
+ public void Claude3Sonnet20240229_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-sonnet-20240229";
+
+ var actual = AnthropicModels.Claude3Sonnet20240229;
+
+ actual.Should().Be(expected);
+ }
+
[Fact]
public void Claude35Sonnet_WhenCalled_ItShouldReturnExpectedValue()
{
@@ -32,6 +62,36 @@ public class AnthropicModelsTests
actual.Should().Be(expected);
}
+ [Fact]
+ public void Claude35Sonnet20240620_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-5-sonnet-20240620";
+
+ var actual = AnthropicModels.Claude35Sonnet20240620;
+
+ actual.Should().Be(expected);
+ }
+
+ [Fact]
+ public void Claude35Sonnet20241022_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-5-sonnet-20241022";
+
+ var actual = AnthropicModels.Claude35Sonnet20241022;
+
+ actual.Should().Be(expected);
+ }
+
+ [Fact]
+ public void Claude35SonnetLatest_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-5-sonnet-latest";
+
+ var actual = AnthropicModels.Claude35SonnetLatest;
+
+ actual.Should().Be(expected);
+ }
+
[Fact]
public void Claude3Haiku_WhenCalled_ItShouldReturnExpectedValue()
{
@@ -43,20 +103,45 @@ public class AnthropicModelsTests
}
[Fact]
- public void Claude35Sonnet_WhenCalled_ItShouldExpectedValue()
+ public void Claude3Haiku20240307_WhenCalled_ItShouldReturnExpectedValue()
{
- var expected = "claude-3-5-sonnet-20240620";
+ var expected = "claude-3-haiku-20240307";
- var actual = AnthropicModels.Claude35Sonnet;
+ var actual = AnthropicModels.Claude3Haiku20240307;
+
+ actual.Should().Be(expected);
+ }
+
+ [Fact]
+ public void Claude35Haiku_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-5-haiku-20241022";
+
+ var actual = AnthropicModels.Claude35Haiku20241022;
+
+ actual.Should().Be(expected);
+ }
+
+ [Fact]
+ public void Claude35HaikuLatest_WhenCalled_ItShouldReturnExpectedValue()
+ {
+ var expected = "claude-3-5-haiku-latest";
+
+ var actual = AnthropicModels.Claude35HaikuLatest;
actual.Should().Be(expected);
}
[Theory]
[InlineData("claude-3-opus-20240229", true)]
+ [InlineData("claude-3-opus-latest", true)]
[InlineData("claude-3-sonnet-20240229", true)]
[InlineData("claude-3-5-sonnet-20240620", true)]
+ [InlineData("claude-3-5-sonnet-20241022", true)]
+ [InlineData("claude-3-5-sonnet-latest", true)]
[InlineData("claude-3-haiku-20240307", true)]
+ [InlineData("claude-3-5-haiku-20241022", true)]
+ [InlineData("claude-3-5-haiku-latest", true)]
[InlineData("invalid", false)]
public void IsValidModel_WhenCalled_ItShouldReturnExpectedValue(string modelId, bool expected)
{
From 9c0a2e37b7e2ee9569348c0f09e638c0bcb6daa7 Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Wed, 1 Jan 2025 18:49:52 -0600
Subject: [PATCH 3/3] chore: run dotnet format
---
src/AnthropicClient/Models/AnthropicModels.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/AnthropicClient/Models/AnthropicModels.cs b/src/AnthropicClient/Models/AnthropicModels.cs
index b09ee2f..f5165d9 100644
--- a/src/AnthropicClient/Models/AnthropicModels.cs
+++ b/src/AnthropicClient/Models/AnthropicModels.cs
@@ -70,18 +70,18 @@ public static class AnthropicModels
///
public const string Claude35HaikuLatest = "claude-3-5-haiku-latest";
- internal static bool IsValidModel(string modelId) => modelId is
- Claude3Opus or
+ internal static bool IsValidModel(string modelId) => modelId is
+ Claude3Opus or
Claude3Opus20241022 or
Claude3OpusLatest or
-
- Claude3Sonnet or
+
+ Claude3Sonnet or
Claude3Sonnet20240229 or
- Claude35Sonnet or
+ Claude35Sonnet or
Claude35Sonnet20240620 or
Claude35Sonnet20241022 or
Claude35SonnetLatest or
-
+
Claude3Haiku or
Claude3Haiku20240307 or
Claude35Haiku20241022 or