Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: "Checkout"
uses: actions/checkout@v3.0.2
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: "Install .NET Core SDK"
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
dotnet-version: |
8.0.x
9.0.x
- name: "Dotnet Tool Restore"
run: dotnet tool restore
shell: pwsh
Expand All @@ -52,7 +54,7 @@ jobs:
run: dotnet cake --target=Pack
shell: pwsh
- name: "Publish Artefacts"
uses: actions/upload-artifact@v3.1.0
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}
path: "./Artefacts"
Expand All @@ -69,7 +71,7 @@ jobs:
runs-on: windows-latest
steps:
- name: "Download Artefact"
uses: actions/download-artifact@v3.0.0
uses: actions/download-artifact@v4
with:
name: "windows-latest"
- name: "Dotnet NuGet Add Source"
Expand All @@ -89,7 +91,7 @@ jobs:
runs-on: windows-latest
steps:
- name: "Download Artefact"
uses: actions/download-artifact@v3.0.0
uses: actions/download-artifact@v4
with:
name: "windows-latest"
- name: "Dotnet NuGet Push"
Expand Down
6 changes: 1 addition & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
<PackageReleaseNotes>https://github.com/tinonetic/anthropic.net/releases</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" PrivateAssets="all" Version="17.3.44" />
<PackageReference Include="MinVer" PrivateAssets="all" Version="4.3.0" />
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="all" Version="1.2.0-beta.435" />
</ItemGroup>


</Project>
24 changes: 12 additions & 12 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
</PropertyGroup>
<ItemGroup>
<!-- Core packages -->
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />

<!-- Test packages -->
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="xunit" Version="2.6.6" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0" />

<!-- Build/Analysis packages -->
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14" />
<PackageVersion Include="MinVer" Version="4.3.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19" />
<PackageVersion Include="MinVer" Version="6.0.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
Expand Down
6 changes: 3 additions & 3 deletions Examples/AnthropicNetDemo/AnthropicNetDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Http" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Examples/AnthropicNetDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static async Task Main()
// Boiler plate code
var config = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddUserSecrets()
.AddUserSecrets<Program>()
.Build();

var host = new HostBuilder()
Expand Down Expand Up @@ -81,7 +81,7 @@ public static async Task Main()

// Sending the question & retrieving the response using Messages API
var messages = new List<Message> { Message.FromUser(question) };
var messageRequest = new MessageRequest(AnthropicModels.Claude_3_Sonnet, messages);
var messageRequest = new MessageRequest(AnthropicModels.Claude3Sonnet, messages);
var messageResponse = await anthropicApiClient.MessageAsync(messageRequest);

// Extract text from the response
Expand Down
20 changes: 9 additions & 11 deletions Source/Anthropic.Net/Anthropic.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@
<PackageTags>Anthropic;Anthropic .NET SDK;Claude;Machine Learning;ML;AI;Artificial Intellegence;API;LLM</PackageTags>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

<!--<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>-->
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.12.19" PrivateAssets="all" />
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>

<!--<ItemGroup>-->
<!--<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" PrivateAssets="all" />-->
<!--<PackageReference Include="MinVer" PrivateAssets="all" />-->
<!--<PackageReference Include="StyleCop.Analyzers" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />-->
<!--</ItemGroup>-->

</Project>
1 change: 1 addition & 0 deletions Source/Anthropic.Net/CompletionRequest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Anthropic.Net;

using System.Collections.Generic;
using System.Text.Json.Serialization;
using Anthropic.Net.Constants;
Expand Down
1 change: 1 addition & 0 deletions Source/Anthropic.Net/CompletionResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Anthropic.Net;

using System.Text.Json.Serialization;

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Source/Anthropic.Net/Constants/AnthropicModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ public static class AnthropicModels
/// <summary>
/// Claude 3 Haiku - Fastest and most compact model in the Claude 3 family.
/// </summary>
public const string Claude_3_Haiku = "claude-3-haiku-20240307";
public const string Claude3Haiku = "claude-3-haiku-20240307";

/// <summary>
/// Claude 3 Sonnet - Balanced model for a wide range of tasks.
/// </summary>
public const string Claude_3_Sonnet = "claude-3-sonnet-20240229";
public const string Claude3Sonnet = "claude-3-sonnet-20240229";

/// <summary>
/// Claude 3 Opus - Most powerful model in the Claude 3 family.
/// </summary>
public const string Claude_3_Opus = "claude-3-opus-20240229";
public const string Claude3Opus = "claude-3-opus-20240229";

/// <summary>
/// Claude 3.5 Sonnet - Latest model with improved capabilities.
/// </summary>
public const string Claude_3_5_Sonnet = "claude-3-5-sonnet-20241022";
public const string Claude35Sonnet = "claude-3-5-sonnet-20241022";
}
1 change: 1 addition & 0 deletions Source/Anthropic.Net/IAnthropicApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Anthropic.Net;

using System.Threading.Tasks;
using Anthropic.Net.Models.Messages;

Expand Down
3 changes: 3 additions & 0 deletions Source/Anthropic.Net/Models/Messages/ContentBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ namespace Anthropic.Net.Models.Messages;
/// <summary>
/// Base class for content blocks in messages.
/// </summary>
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
[JsonDerivedType(typeof(TextContentBlock), typeDiscriminator: "text")]
[JsonDerivedType(typeof(ImageContentBlock), typeDiscriminator: "image")]
public abstract class ContentBlock
{
/// <summary>
Expand Down
14 changes: 6 additions & 8 deletions Tests/Anthropic.Net.Tests/Anthropic.Net.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NSubstitute" />
<PackageReference Include="coverlet.collector" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Source\Anthropic.Net\Anthropic.Net.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Tests/Anthropic.Net.Tests/ApiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task TestMessageAsync_ValidRequestAsync()

// Act
var messages = new List<Message> { Message.FromUser("Hello, Claude!") };
var response = await sut.MessageAsync(new MessageRequest(AnthropicModels.Claude_3_Sonnet, messages))
var response = await sut.MessageAsync(new MessageRequest(AnthropicModels.Claude3Sonnet, messages))
.ConfigureAwait(true);

// Assert
Expand Down
2 changes: 1 addition & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.2.0",
"version": "4.0.0",
"commands": [
"dotnet-cake"
]
Expand Down
Loading