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:
Stevan Freeborn
2025-06-14 13:44:10 -05:00
parent d50989833e
commit 5b8d88a01d
21 changed files with 450 additions and 123 deletions
+32
View File
@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;
namespace AnthropicClient.Models;
/// <summary>
/// Represents a citation
/// </summary>
public abstract class Citation
{
/// <summary>
/// Gets the type of the citation.
/// </summary>
public string Type { get; init; } = string.Empty;
/// <summary>
/// Gets the text that is cited.
/// </summary>
[JsonPropertyName("cited_text")]
public string CitedText { get; init; } = string.Empty;
/// <summary>
/// Gets the document index of the citation.
/// </summary>
[JsonPropertyName("document_index")]
public int DocumentIndex { get; init; }
/// <summary>
/// Gets the title of the document from which the citation is made.
/// </summary>
[JsonPropertyName("document_title")]
public string DocumentTitle { get; init; } = string.Empty;
}