Skip to content

CitationLocation

type CitationLocation =
| {
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;
};

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

Discriminated union of citation location types. Each variant uses a type field to identify the location kind.

{
type: "documentChar";
documentIndex: number;
start: number;
end: number;
}
NameTypeDescriptionDefined in
type"documentChar"Location referencing character positions within a document.src/types/citations.ts:19
documentIndexnumberIndex of the source document.src/types/citations.ts:24
startnumberStart character position.src/types/citations.ts:29
endnumberEnd character position.src/types/citations.ts:34
{
type: "documentPage";
documentIndex: number;
start: number;
end: number;
}
NameTypeDescriptionDefined in
type"documentPage"Location referencing page positions within a document.src/types/citations.ts:40
documentIndexnumberIndex of the source document.src/types/citations.ts:45
startnumberStart page number.src/types/citations.ts:50
endnumberEnd page number.src/types/citations.ts:55
{
type: "documentChunk";
documentIndex: number;
start: number;
end: number;
}
NameTypeDescriptionDefined in
type"documentChunk"Location referencing chunk positions within a document.src/types/citations.ts:61
documentIndexnumberIndex of the source document.src/types/citations.ts:66
startnumberStart chunk index.src/types/citations.ts:71
endnumberEnd chunk index.src/types/citations.ts:76
{
type: "searchResult";
searchResultIndex: number;
start: number;
end: number;
}
NameTypeDescriptionDefined in
type"searchResult"Location referencing a search result.src/types/citations.ts:82
searchResultIndexnumberIndex of the search result.src/types/citations.ts:87
startnumberStart position within the search result.src/types/citations.ts:92
endnumberEnd position within the search result.src/types/citations.ts:97
{
type: "web";
url: string;
domain?: string;
}
NameTypeDescriptionDefined in
type"web"Location referencing a web URL.src/types/citations.ts:103
urlstringThe URL of the web source.src/types/citations.ts:108
domain?stringThe domain of the web source.src/types/citations.ts:113