Skip to content

CitationsBlock

Defined in: src/types/citations.ts:173

Citations content block within a message. Returned by models when document citations are enabled. This is an output-only block — users do not construct these directly.

new CitationsBlock(data): CitationsBlock;

Defined in: src/types/citations.ts:191

| Parameter | Type | | --------- | ---------------------------------------------- | | data | CitationsBlockData |

CitationsBlock

readonly type: "citationsBlock";

Defined in: src/types/citations.ts:179

Discriminator for citations content.


readonly citations: Citation[];

Defined in: src/types/citations.ts:184

Array of citations linking generated content to source locations.

CitationsBlockData.citations


readonly content: CitationGeneratedContent[];

Defined in: src/types/citations.ts:189

The generated content associated with these citations.

CitationsBlockData.content

toJSON(): {
citations: {
citations: {
location: | {
type: "documentChar";
documentIndex: number;
start: number;
end: number;
}
| {
type: "documentPage";
documentIndex: number;
start: number;
end: number;
}
| {
type: "documentChunk";
documentIndex: number;
start: number;
end: number;
}
| {
type: "searchResult";
searchResultIndex: number;
start: number;
end: number;
}
| {
type: "web";
url: string;
domain?: string;
};
source: string;
sourceContent: {
text: string;
}[];
title: string;
}[];
content: {
text: string;
}[];
};
};

Defined in: src/types/citations.ts:200

Serializes the CitationsBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify().

{
citations: {
citations: {
location: | {
type: "documentChar";
documentIndex: number;
start: number;
end: number;
}
| {
type: "documentPage";
documentIndex: number;
start: number;
end: number;
}
| {
type: "documentChunk";
documentIndex: number;
start: number;
end: number;
}
| {
type: "searchResult";
searchResultIndex: number;
start: number;
end: number;
}
| {
type: "web";
url: string;
domain?: string;
};
source: string;
sourceContent: {
text: string;
}[];
title: string;
}[];
content: {
text: string;
}[];
};
}

| Name | Type | Description | Defined in | | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | citations | { citations: { location: | { type: "documentChar"; documentIndex: number; start: number; end: number; } | { type: "documentPage"; documentIndex: number; start: number; end: number; } | { type: "documentChunk"; documentIndex: number; start: number; end: number; } | { type: "searchResult"; searchResultIndex: number; start: number; end: number; } | { type: "web"; url: string; domain?: string; }; source: string; sourceContent: { text: string; }[]; title: string; }[]; content: { text: string; }[]; } | - | src/types/citations.ts:200 | | citations.citations | { location: | { type: "documentChar"; documentIndex: number; start: number; end: number; } | { type: "documentPage"; documentIndex: number; start: number; end: number; } | { type: "documentChunk"; documentIndex: number; start: number; end: number; } | { type: "searchResult"; searchResultIndex: number; start: number; end: number; } | { type: "web"; url: string; domain?: string; }; source: string; sourceContent: { text: string; }[]; title: string; }[] | Array of citations linking generated content to source locations. | src/types/citations.ts:160 | | citations.content | { text: string; }[] | The generated content associated with these citations. | src/types/citations.ts:165 |

JSONSerializable.toJSON

static fromJSON(data): CitationsBlock;

Defined in: src/types/citations.ts:215

Creates a CitationsBlock instance from its wrapped data format.

| Parameter | Type | Description | | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | | data | { citations: { citations: { location: | { type: "documentChar"; documentIndex: number; start: number; end: number; } | { type: "documentPage"; documentIndex: number; start: number; end: number; } | { type: "documentChunk"; documentIndex: number; start: number; end: number; } | { type: "searchResult"; searchResultIndex: number; start: number; end: number; } | { type: "web"; url: string; domain?: string; }; source: string; sourceContent: { text: string; }[]; title: string; }[]; content: { text: string; }[]; }; } | Wrapped CitationsBlockData to deserialize | | data.citations | { citations: { location: | { type: "documentChar"; documentIndex: number; start: number; end: number; } | { type: "documentPage"; documentIndex: number; start: number; end: number; } | { type: "documentChunk"; documentIndex: number; start: number; end: number; } | { type: "searchResult"; searchResultIndex: number; start: number; end: number; } | { type: "web"; url: string; domain?: string; }; source: string; sourceContent: { text: string; }[]; title: string; }[]; content: { text: string; }[]; } | - | | data.citations.citations | { location: | { type: "documentChar"; documentIndex: number; start: number; end: number; } | { type: "documentPage"; documentIndex: number; start: number; end: number; } | { type: "documentChunk"; documentIndex: number; start: number; end: number; } | { type: "searchResult"; searchResultIndex: number; start: number; end: number; } | { type: "web"; url: string; domain?: string; }; source: string; sourceContent: { text: string; }[]; title: string; }[] | Array of citations linking generated content to source locations. | | data.citations.content | { text: string; }[] | The generated content associated with these citations. |

CitationsBlock

CitationsBlock instance