A source the assistant used for an answer: a web page, a document or a record a tool returned. Citations come from the CitationAnnotation annotations a provider attaches to the response (OpenAI web search, Perplexity, Azure AI Search and others) and from tools that return ChatCitation instances; both are collected in Citations and rendered under the answer.
Object
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class ChatCitationA source the assistant used for an answer: a web page, a document or a record a tool returned. Citations come from the CitationAnnotation annotations a provider attaches to the response (OpenAI web search, Perplexity, Azure AI Search and others) and from tools that return ChatCitation instances; both are collected in Citations and rendered under the answer.
public ChatCitation()Gets or sets the identifier of the file the citation refers to, for providers that cite uploaded files.
public string FileId { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the identifier of the file the citation refers to, for providers that cite uploaded files. |
Gets or sets the part of the source the answer is based on. Sent to the model when a tool returns the citation and shown as a tooltip.
public string Snippet { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the part of the source the answer is based on. Sent to the model when a tool returns the citation and shown as a tooltip. |
Gets or sets the title of the source.
public string Title { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the title of the source. |
Gets or sets the name of the tool that produced the citation.
public string ToolName { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the name of the tool that produced the citation. |
Gets or sets the URL of the source. Rendered as a link when set.
public string Url { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the URL of the source. Rendered as a link when set. |
Creates a citation from a CitationAnnotation.
public static ChatCitation FromAnnotation(Microsoft.Extensions.AI.CitationAnnotation annotation)
| Type | Name | Description |
|---|---|---|
| Microsoft.Extensions.AI.CitationAnnotation | annotation | The annotation. |
| Type | Description |
|---|---|
| ChatCitation |
Collects the citations a piece of response content carries: its CitationAnnotation annotations and, for a tool result, the ChatCitation instances the tool returned, as objects or as the JSON AIFunctionFactory produces from them (objects with only title, url, snippet, fileId and toolName properties).
public static IEnumerable<ChatCitation> FromContent(Microsoft.Extensions.AI.AIContent content)
| Type | Name | Description |
|---|---|---|
| Microsoft.Extensions.AI.AIContent | content | The content. |
| Type | Description |
|---|---|
| IEnumerable<ChatCitation> |
Returns whether this citation refers to the same source as another one: the same URL, or the same file, or the same title when neither is set.
public bool IsSameSource(ChatCitation other)
| Type | Name | Description |
|---|---|---|
| ChatCitation | other | The other citation. |
| Type | Description |
|---|---|
| bool |
Replaces the citation markers some models emit, such as the 【1†source】 markers of gpt-oss models, with plain [1] markers that render as text.
public static string NormalizeMarkers(string text)
| Type | Name | Description |
|---|---|---|
| string | text | The answer text. |
| Type | Description |
|---|---|
| string |
Replaces the citation markers some models emit, such as the 【1†source】 markers of gpt-oss models, with plain [1] markers that render as text.
public static void NormalizeMarkers(ChatMessage message)
| Type | Name | Description |
|---|---|---|
| ChatMessage | message |
Converts the citation to the CitationAnnotation providers and AI consumers understand.
public Microsoft.Extensions.AI.CitationAnnotation ToAnnotation()
| Type | Description |
|---|---|
| Microsoft.Extensions.AI.CitationAnnotation |