How can I access the specific text of the file that the annotation is referencing?

I’m trying to create a feature where an annotation in a response from an assistant (with file-search enabled) can be clicked and the specific text that it references from a PDF will be highlighted. However, although the documentation says that there is a “quote” field in the annotation this field never shows up:

Any sort of indication of where the annotation is referencing in the file (e.g. a text offset, quote, etc.) would be helpful, but there doesn’t seem to be any way to find any meaningful subsection of a while to which the assistant is referring in their annotations.

1 Like

The AI of assistants v2 no longer has a method to “mark” text for an annotation. It can only refer to a file ID.

Is there any workaround to get annotations with direct quotes?

You could write your own vector database API tool and instructions that replicate the selection and “marking” behavior, where the files browser had received back its information with line numbers. A tool “line_number_range_of_document_ID_to_offer_as_documentation_download_in_user_interface_before_response_to_user”?

The v2 AI no longer can write the same output that the API backend then parses into annotations, giving ranges of text.

That’s right – we don’t have support for quotes from the file at the moment. We’ll work on adding support for this!

A post was split to a new topic: Can Someone Guide Me on Adding Pricing to My Website?

Is there an open issue for this? I found this on in the OpenAPI repo, quote is non-nullable and all responses will fail client response validation.