Skip to content

Commit 7ed5211

Browse files
committed
docs: clarify meaning of 'index' field in annotation models (fixes #2512)
Signed-off-by: Navadeep0007 <[email protected]>
1 parent 650be39 commit 7ed5211

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/openai/types/responses/response_output_text.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ class AnnotationFileCitation(BaseModel):
2626
"""The filename of the file cited."""
2727

2828
index: int
29-
"""The index of the file in the list of files."""
29+
"""The position index in the message text where the file citation appears.
30+
31+
This indicates the location (by character index) in the model’s output text
32+
where the cited file is referenced. For example, if `index=25`, the citation
33+
starts near the 25th character in the output message.
34+
"""
3035

3136
type: Literal["file_citation"]
3237
"""The type of the file citation. Always `file_citation`."""
@@ -74,14 +79,24 @@ class AnnotationFilePath(BaseModel):
7479
"""The ID of the file."""
7580

7681
index: int
77-
"""The index of the file in the list of files."""
82+
"""The position index in the message text where the file path reference appears.
83+
84+
This indicates where in the text the path citation begins.
85+
For example, if `index=42`, the file path is referenced around the 42nd
86+
character of the model output.
87+
"""
7888

7989
type: Literal["file_path"]
8090
"""The type of the file path. Always `file_path`."""
8191

8292

8393
Annotation: TypeAlias = Annotated[
84-
Union[AnnotationFileCitation, AnnotationURLCitation, AnnotationContainerFileCitation, AnnotationFilePath],
94+
Union[
95+
AnnotationFileCitation,
96+
AnnotationURLCitation,
97+
AnnotationContainerFileCitation,
98+
AnnotationFilePath,
99+
],
85100
PropertyInfo(discriminator="type"),
86101
]
87102

@@ -115,3 +130,4 @@ class ResponseOutputText(BaseModel):
115130
"""The type of the output text. Always `output_text`."""
116131

117132
logprobs: Optional[List[Logprob]] = None
133+

0 commit comments

Comments
 (0)