ChatCitation Class

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.

Inheritance

Object

ChatCitation

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class ChatCitation

Constructors

ChatCitationLink to this section

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.

Declaration
public ChatCitation()

Properties

FileIdLink to this section

Gets or sets the identifier of the file the citation refers to, for providers that cite uploaded files.

Declaration
public string FileId { get; set; }
Property Value
Type Description
stringGets or sets the identifier of the file the citation refers to, for providers that cite uploaded files.

SnippetLink to this section

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.

Declaration
public string Snippet { get; set; }
Property Value
Type Description
stringGets 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.

TitleLink to this section

Gets or sets the title of the source.

Declaration
public string Title { get; set; }
Property Value
Type Description
stringGets or sets the title of the source.

ToolNameLink to this section

Gets or sets the name of the tool that produced the citation.

Declaration
public string ToolName { get; set; }
Property Value
Type Description
stringGets or sets the name of the tool that produced the citation.

UrlLink to this section

Gets or sets the URL of the source. Rendered as a link when set.

Declaration
public string Url { get; set; }
Property Value
Type Description
stringGets or sets the URL of the source. Rendered as a link when set.

Methods

FromAnnotationLink to this section

Creates a citation from a CitationAnnotation.

Declaration
public static ChatCitation FromAnnotation(Microsoft.Extensions.AI.CitationAnnotation annotation)
Parameters
Type Name Description
Microsoft.Extensions.AI.CitationAnnotation annotation The annotation.
Returns
Type Description
ChatCitation

FromContentLink to this section

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).

Declaration
public static IEnumerable<ChatCitation> FromContent(Microsoft.Extensions.AI.AIContent content)
Parameters
Type Name Description
Microsoft.Extensions.AI.AIContent content The content.
Returns
Type Description
IEnumerable<ChatCitation>

IsSameSourceLink to this section

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.

Declaration
public bool IsSameSource(ChatCitation other)
Parameters
Type Name Description
ChatCitation other The other citation.
Returns
Type Description
bool

NormalizeMarkersLink to this section

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.

Declaration
public static string NormalizeMarkers(string text)
Parameters
Type Name Description
string text The answer text.
Returns
Type Description
string

NormalizeMarkersLink to this section

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.

Declaration
public static void NormalizeMarkers(ChatMessage message)
Parameters
Type Name Description
ChatMessage message

ToAnnotationLink to this section

Converts the citation to the CitationAnnotation providers and AI consumers understand.

Declaration
public Microsoft.Extensions.AI.CitationAnnotation ToAnnotation()
Returns
Type Description
Microsoft.Extensions.AI.CitationAnnotation
An error has occurred. This app may no longer respond until reloaded. Reload 🗙