FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sdk-python/src/strands/types/citations.py at main · polytech-dev/sdk-python · GitHub
polytech-dev
/
sdk-python
Public
forked from
strands-agents/harness-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sdk-python
/
src
/
strands
/
types
/
citations.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
152 lines (106 loc) · 4.74 KB
Breadcrumbs
sdk-python
/
src
/
strands
/
types
/
citations.py
Copy path
File metadata and controls
152 lines (106 loc) · 4.74 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
"""Citation type definitions for the SDK.
These types are modeled after the Bedrock API.
"""
from
typing
import
List
,
Union
from
typing_extensions
import
TypedDict
class
CitationsConfig
(
TypedDict
):
"""Configuration for enabling citations on documents.
Attributes:
enabled: Whether citations are enabled for this document.
"""
enabled
:
bool
class
DocumentCharLocation
(
TypedDict
,
total
=
False
):
"""Specifies a character-level location within a document.
Provides precise positioning information for cited content using
start and end character indices.
Attributes:
documentIndex: The index of the document within the array of documents
provided in the request. Minimum value of 0.
start: The starting character position of the cited content within
the document. Minimum value of 0.
end: The ending character position of the cited content within
the document. Minimum value of 0.
"""
documentIndex
:
int
start
:
int
end
:
int
class
DocumentChunkLocation
(
TypedDict
,
total
=
False
):
"""Specifies a chunk-level location within a document.
Provides positioning information for cited content using logical
document segments or chunks.
Attributes:
documentIndex: The index of the document within the array of documents
provided in the request. Minimum value of 0.
start: The starting chunk identifier or index of the cited content
within the document. Minimum value of 0.
end: The ending chunk identifier or index of the cited content
within the document. Minimum value of 0.
"""
documentIndex
:
int
start
:
int
end
:
int
class
DocumentPageLocation
(
TypedDict
,
total
=
False
):
"""Specifies a page-level location within a document.
Provides positioning information for cited content using page numbers.
Attributes:
documentIndex: The index of the document within the array of documents
provided in the request. Minimum value of 0.
start: The starting page number of the cited content within
the document. Minimum value of 0.
end: The ending page number of the cited content within
the document. Minimum value of 0.
"""
documentIndex
:
int
start
:
int
end
:
int
# Union type for citation locations
CitationLocation
=
Union
[
DocumentCharLocation
,
DocumentChunkLocation
,
DocumentPageLocation
]
class
CitationSourceContent
(
TypedDict
,
total
=
False
):
"""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:
text: The text content from the source document that is being cited.
"""
text
:
str
class
CitationGeneratedContent
(
TypedDict
,
total
=
False
):
"""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:
text: The text content that was generated by the model and is
supported by the associated citation.
"""
text
:
str
class
Citation
(
TypedDict
,
total
=
False
):
"""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:
location: The precise location within the source document where the
cited content can be found, including character positions, page
numbers, or chunk identifiers.
sourceContent: The specific content from the source document that was
referenced or cited in the generated response.
title: The title or identifier of the source document being cited.
"""
location
:
CitationLocation
sourceContent
:
List
[
CitationSourceContent
]
title
:
str
class
CitationsContentBlock
(
TypedDict
,
total
=
False
):
"""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:
citations: An array of citations that reference the source documents
used to generate the associated content.
content: The generated content that is supported by the associated
citations.
"""
citations
:
List
[
Citation
]
content
:
List
[
CitationGeneratedContent
]
Back
|
FazBrowse Home
|
New Git URL