feat: add support for citations when streaming
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -14,4 +14,9 @@ public static class ContentDeltaType
|
||||
/// The input_json_delta.
|
||||
/// </summary>
|
||||
public const string JsonDelta = "input_json_delta";
|
||||
|
||||
/// <summary>
|
||||
/// The citation_delta.
|
||||
/// </summary>
|
||||
public const string CitationDelta = "citations_delta";
|
||||
}
|
||||
Reference in New Issue
Block a user