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
6 changes: 3 additions & 3 deletions Anthropic.SDK.Tests/Anthropic.SDK.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
<ItemGroup>
<PackageReference Include="Google.Cloud.AIPlatform.V1" Version="3.24.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.AI" Version="9.5.0" />
<PackageReference Include="Microsoft.Extensions.AI" Version="9.6.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.54.0" />
<PackageReference Include="Microsoft.SemanticKernel.Abstractions" Version="1.54.0" />
<PackageReference Include="Microsoft.SemanticKernel" Version="1.58.0" />
<PackageReference Include="Microsoft.SemanticKernel.Abstractions" Version="1.58.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.8.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.8.2" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
Expand Down
25 changes: 24 additions & 1 deletion Anthropic.SDK.Tests/Messages.ChatClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
Expand Down Expand Up @@ -232,6 +233,28 @@ public async Task TestNonStreamingFunctionCalls()
res.Text);
}

[TestMethod]
public async Task TestNonStreamingWebSearchCalls()
{
IChatClient client = new AnthropicClient().Messages
.AsBuilder()
.UseFunctionInvocation()
.Build();

ChatOptions options = new()
{
ModelId = AnthropicModels.Claude4Sonnet,
MaxOutputTokens = 5000,
Tools = [new HostedWebSearchTool()]
};

var res = await client.GetResponseAsync("What is the weather like in San Francisco, CA right now?", options);

Assert.IsTrue(
res.Text.Contains("San Francisco") is true,
res.Text);
}

[TestMethod]
public async Task TestStreamingFunctionCalls()
{
Expand Down
10 changes: 5 additions & 5 deletions Anthropic.SDK/Anthropic.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<PackageTags>Claude, AI, ML, API, Anthropic</PackageTags>
<Title>Claude API</Title>
<PackageReleaseNotes>
Web Search, MCP Servers, and Claude 4 Models, Minor Bug Fixes
Improvements to Microsoft.Extensions.AI.Abstractions integration
</PackageReleaseNotes>
<PackageId>Anthropic.SDK</PackageId>
<Version>5.4.1</Version>
<AssemblyVersion>5.4.1.0</AssemblyVersion>
<FileVersion>5.4.1.0</FileVersion>
<Version>5.4.2</Version>
<AssemblyVersion>5.4.2.0</AssemblyVersion>
<FileVersion>5.4.2.0</FileVersion>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
Expand All @@ -34,7 +34,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" Version="9.5.0" />
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" Version="9.6.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
</ItemGroup>

Expand Down
3 changes: 3 additions & 0 deletions Anthropic.SDK/Messaging/ChatClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public static MessageParameters CreateMessageParameters(IChatClient client, IEnu
case HostedCodeInterpreterTool ci:
tools.Add(Common.Tool.CodeInterpreter);
break;
case HostedWebSearchTool wt:
tools.Add(ServerTools.GetWebSearchTool(5));
break;
}
}
}
Expand Down
Loading