FieldCure.AssistStudio.Anthropic
0.2.0-preview.4
dotnet add package FieldCure.AssistStudio.Anthropic --version 0.2.0-preview.4
NuGet\Install-Package FieldCure.AssistStudio.Anthropic -Version 0.2.0-preview.4
<PackageReference Include="FieldCure.AssistStudio.Anthropic" Version="0.2.0-preview.4" />
<PackageVersion Include="FieldCure.AssistStudio.Anthropic" Version="0.2.0-preview.4" />
<PackageReference Include="FieldCure.AssistStudio.Anthropic" />
paket add FieldCure.AssistStudio.Anthropic --version 0.2.0-preview.4
#r "nuget: FieldCure.AssistStudio.Anthropic, 0.2.0-preview.4"
#:package FieldCure.AssistStudio.Anthropic@0.2.0-preview.4
#addin nuget:?package=FieldCure.AssistStudio.Anthropic&version=0.2.0-preview.4&prerelease
#tool nuget:?package=FieldCure.AssistStudio.Anthropic&version=0.2.0-preview.4&prerelease
FieldCure.AssistStudio.Anthropic
Platform-agnostic Anthropic SDK adapter for the AssistStudio ecosystem. Maps Anthropic streaming events to StreamEvent and converts ChatMessage to SDK MessageParam.
Features
- AnthropicStreamEventMapper — Stateful, per-stream mapper that converts
RawMessageStreamEventtoIAsyncEnumerable<StreamEvent>. Handles text deltas, thinking deltas, usage, truncation, and unknown block types gracefully. - AnthropicMessageConverter — Converts
ChatMessagelists to AnthropicMessageParamformat. Extracts system prompts, handles image/text attachments, and groups messages by role. - Platform-agnostic — Targets
net8.0andnet9.0. No WinUI, no Windows dependency. Use in console apps, ASP.NET, MAUI, or any .NET host.
Install
dotnet add package FieldCure.AssistStudio.Anthropic
Usage
Stream mapping
using FieldCure.AssistStudio.Anthropic;
var mapper = new AnthropicStreamEventMapper();
var sdkStream = client.Messages.CreateStreaming(params);
await foreach (var evt in mapper.MapAsync(sdkStream))
{
switch (evt)
{
case StreamEvent.TextDelta td:
Console.Write(td.Text);
break;
case StreamEvent.ThinkingDelta tk:
// extended thinking content
break;
case StreamEvent.Usage u:
Console.WriteLine($"Tokens: {u.TokenUsage.TotalTokens}");
break;
case StreamEvent.StreamCompleted sc:
Console.WriteLine(sc.IsTruncated ? "(truncated)" : "(done)");
break;
}
}
Message conversion
var result = AnthropicMessageConverter.Convert(messages);
var response = await client.Messages.Create(new()
{
Model = "claude-sonnet-4-6",
System = result.SystemPrompt is not null
? new(result.SystemPrompt) : null,
Messages = result.Messages,
MaxTokens = 4096,
});
Dependencies
| Package | Version |
|---|---|
| Anthropic | >= 12.13.0 |
| FieldCure.Ai.Providers | (transitive) |
Related Packages
| Package | Description |
|---|---|
| FieldCure.AssistStudio.Controls.WinUI.Anthropic | WinUI 3 ChatPanel integration — extension methods to stream Anthropic responses directly into the chat UI |
| FieldCure.AssistStudio.Controls.WinUI | The ChatPanel control itself |
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Anthropic (>= 12.21.0)
- FieldCure.Ai.Providers (>= 0.8.0)
-
net8.0
- Anthropic (>= 12.21.0)
- FieldCure.Ai.Providers (>= 0.8.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FieldCure.AssistStudio.Anthropic:
| Package | Downloads |
|---|---|
|
FieldCure.AssistStudio.Controls.WinUI.Anthropic
WinUI 3 ChatPanel integration for the Anthropic SDK. Provides extension methods to stream Anthropic responses into ChatPanel. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0-preview.4 | 69 | 5/25/2026 |
| 0.1.0-preview.3 | 73 | 5/4/2026 |
| 0.1.0-preview.2 | 64 | 4/27/2026 |
| 0.1.0-preview.1 | 61 | 4/21/2026 |
v0.2.0-preview.4: Tool calling support — AnthropicMessageConverter now groups consecutive ChatRole.Tool messages into a single user MessageParam carrying ToolResultBlockParam entries (Anthropic requires this; separate user messages 422). ConvertAssistantMessage emits a mixed [TextBlockParam?, ToolUseBlockParam, ...] content list whenever ToolCalls is populated; pure-text turns keep the simple string form. AnthropicStreamEventMapper now emits ToolCallStart on block-start and ToolCallDelta on InputJsonDelta for regular ToolUse blocks; ServerToolUse is tracked but intentionally not surfaced (those tools run inside the SDK). The new file-level StopReason alias (SdkStopReason) disambiguates against the Ai.Providers 0.8.0 domain enum that landed concurrently. Anthropic SDK pin 12.16.0 → 12.21.0 (five minor versions, no breaking changes to the surface this adapter uses). Multi-target: net9 dropped (STS EOL 2026-05-12), net10 added — now net8.0 + net10.0. Phase B (thinking signature round-trip alongside tool calls) deferred — package remains preview until that lands.