strands.types.citations
¶
Citation type definitions for the SDK.
These types are modeled after the Bedrock API.
CitationLocation = Union[DocumentCharLocationDict, DocumentPageLocationDict, DocumentChunkLocationDict, SearchResultLocationDict, WebLocationDict]
module-attribute
¶
DocumentCharLocationDict = dict[Literal['documentChar'], DocumentCharLocation]
module-attribute
¶
DocumentChunkLocationDict = dict[Literal['documentChunk'], DocumentChunkLocation]
module-attribute
¶
DocumentPageLocationDict = dict[Literal['documentPage'], DocumentPageLocation]
module-attribute
¶
SearchResultLocationDict = dict[Literal['searchResultLocation'], SearchResultLocation]
module-attribute
¶
WebLocationDict = dict[Literal['web'], WebLocation]
module-attribute
¶
Citation
¶
Bases: TypedDict
Contains information about a citation that references a source document.
Citations provide traceability between the model's generated response and the source documents that informed that response.
Attributes:
| Name | Type | Description |
|---|---|---|
location |
CitationLocation
|
The precise location within the source document where the cited content can be found, including character positions, page numbers, or chunk identifiers. |
sourceContent |
List[CitationSourceContent]
|
The specific content from the source document that was referenced or cited in the generated response. |
title |
str
|
The title or identifier of the source document being cited. |
Source code in strands/types/citations.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
CitationGeneratedContent
¶
Bases: TypedDict
Contains the generated text content that corresponds to a citation.
Contains the generated text content that corresponds to or is supported by a citation from a source document.
Note
This is a UNION type, so only one of the members can be specified.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
The text content that was generated by the model and is supported by the associated citation. |
Source code in strands/types/citations.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
CitationSourceContent
¶
Bases: TypedDict
Contains the actual text content from a source document.
Contains the actual text content from a source document that is being cited or referenced in the model's response.
Note
This is a UNION type, so only one of the members can be specified.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
The text content from the source document that is being cited. |
Source code in strands/types/citations.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
CitationsConfig
¶
Bases: TypedDict
Configuration for enabling citations on documents.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
Whether citations are enabled for this document. |
Source code in strands/types/citations.py
11 12 13 14 15 16 17 18 | |
CitationsContentBlock
¶
Bases: TypedDict
A content block containing generated text and associated citations.
This block type is returned when document citations are enabled, providing traceability between the generated content and the source documents that informed the response.
Attributes:
| Name | Type | Description |
|---|---|---|
citations |
List[Citation]
|
An array of citations that reference the source documents used to generate the associated content. |
content |
List[CitationGeneratedContent]
|
The generated content that is supported by the associated citations. |
Source code in strands/types/citations.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
DocumentCharLocation
¶
Bases: TypedDict
Specifies a character-level location within a document.
Provides precise positioning information for cited content using start and end character indices.
Attributes:
| Name | Type | Description |
|---|---|---|
documentIndex |
int
|
The index of the document within the array of documents provided in the request. Minimum value of 0. |
start |
int
|
The starting character position of the cited content within the document. Minimum value of 0. |
end |
int
|
The ending character position of the cited content within the document. Minimum value of 0. |
Source code in strands/types/citations.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
DocumentChunkLocation
¶
Bases: TypedDict
Specifies a chunk-level location within a document.
Provides positioning information for cited content using logical document segments or chunks.
Attributes:
| Name | Type | Description |
|---|---|---|
documentIndex |
int
|
The index of the document within the array of documents provided in the request. Minimum value of 0. |
start |
int
|
The starting chunk identifier or index of the cited content within the document. Minimum value of 0. |
end |
int
|
The ending chunk identifier or index of the cited content within the document. Minimum value of 0. |
Source code in strands/types/citations.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
DocumentPageLocation
¶
Bases: TypedDict
Specifies a page-level location within a document.
Provides positioning information for cited content using page numbers.
Attributes:
| Name | Type | Description |
|---|---|---|
documentIndex |
int
|
The index of the document within the array of documents provided in the request. Minimum value of 0. |
start |
int
|
The starting page number of the cited content within the document. Minimum value of 0. |
end |
int
|
The ending page number of the cited content within the document. Minimum value of 0. |
Source code in strands/types/citations.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
SearchResultLocation
¶
Bases: TypedDict
Specifies a search result location within the content array.
Provides positioning information for cited content using search result index and block positions.
Attributes:
| Name | Type | Description |
|---|---|---|
searchResultIndex |
int
|
The index of the search result content block where the cited content is found. Minimum value of 0. |
start |
int
|
The starting position in the content array where the cited content begins. Minimum value of 0. |
end |
int
|
The ending position in the content array where the cited content ends. Minimum value of 0. |
Source code in strands/types/citations.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
WebLocation
¶
Bases: TypedDict
Provides the URL and domain information for a cited website.
Contains information about the website that was cited when performing a web search.
Attributes:
| Name | Type | Description |
|---|---|---|
url |
str
|
The URL that was cited when performing a web search. |
domain |
str
|
The domain that was cited when performing a web search. |
Source code in strands/types/citations.py
100 101 102 103 104 105 106 107 108 109 110 111 112 | |