openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

Update index documentation

Open nb-park opened this issue 1 year ago • 1 comments

AnnotationFileCitation wrongly references a file index instead of a text index. To match the url citation better, I suggest """The index at which to insert the file citation in the message.""". A more verbose string could give an example of inserting the citation.

https://github.com/openai/openai-python/blob/a8258744cbecf51321587fc870e8920bd2c07809/src/openai/types/responses/response_output_text.py#L28-L29

My interpretation is founded in a discussion and experimental observation that index lines up with the end of a word in the output_text. Note that for a "manual" check account for new lines as a single character and be aware that a text editor may not have a zero-indexed character position.

See also the file search guide. It is slightly ambiguous until tested that it refers to to an insertion point and not the location within the cited document.

Making a further observation within the same file, AnnotationFilePath has the same documentation for index, but it isn't relevant to my use case so I'm not sure how accurate it is.

nb-park avatar Aug 06 '25 17:08 nb-park

Thanks for flagging this. The same wording appears in the OpenAPI schema, so I’ve moved the FileCitation index documentation correction to https://github.com/openai/openai-openapi/issues/584 and linked your original report there.

I’m closing this SDK report as migrated; this does not mean a fix has shipped. The separate, unverified FilePath observation is outside the canonical issue’s scope.

markstuart-oai avatar Sep 24 '26 22:09 markstuart-oai