feat: add support for citations
BREAKING CHANGE: Changed type of public Source properties. Updated `Source` property on `DocumentContent` and `ImageContent` types to use base `Source` type - include support for citing custom sources - include support for citing PDF sources - include support for citing text sources
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using AnthropicClient.Utils;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a custom source that contains a list of text content.
|
||||
/// </summary>
|
||||
public class CustomSource : Source
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the list of text content that makes up the custom source.
|
||||
/// </summary>
|
||||
public List<TextContent> Content { get; init; } = [];
|
||||
|
||||
[JsonConstructor]
|
||||
internal CustomSource() : base(SourceType.Content)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomSource"/> class.
|
||||
/// </summary>
|
||||
/// <returns>A new instance of the <see cref="CustomSource"/> class.</returns>
|
||||
/// <exception cref="ArgumentNullException">Thrown when the content is null.</exception>
|
||||
public CustomSource(List<TextContent> content) : base(SourceType.Content)
|
||||
{
|
||||
ArgumentValidator.ThrowIfNull(content, nameof(content));
|
||||
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user