feat: add support for citations when streaming

This commit is contained in:
Stevan Freeborn
2025-06-14 22:24:44 -05:00
parent 74ac1ffc06
commit 98da1384c1
5 changed files with 188 additions and 7 deletions
@@ -0,0 +1,30 @@
using System.Text.Json.Serialization;
using AnthropicClient.Utils;
namespace AnthropicClient.Models;
/// <summary>
/// Represents a citation delta.
/// </summary>
public class CitationDelta : ContentDelta
{
/// <summary>
/// Gets the citation associated with this delta.
/// </summary>
public Citation Citation { get; init; } = new CharacterLocationCitation();
[JsonConstructor]
internal CitationDelta() : base(ContentDeltaType.CitationDelta)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CitationDelta"/> class.
/// </summary>
public CitationDelta(Citation citation) : base(ContentDeltaType.CitationDelta)
{
ArgumentValidator.ThrowIfNull(citation, nameof(citation));
Citation = citation;
}
}