How can I access file_citation?

Hi, I’m currently utilizing the Assistant API along with the retrieval function. I can obtain the output with RAG, but I’m unable to receive the file citations. I’ve been following the instructions on this page, yet regardless of the document I attempt to use with RAG, it doesn’t return any annotations—the section is always blank. I’d like to be able to access the referred documents to determine the length of the retrieved document. Any guidance would be appreciated. Thank you!

For your reference, here is the code I use.

data_name = "path_to_data"
instructions = "instruction"
content = "input"

file = client.files.create(
  file=open(path + f"data/{data_name}", "rb"),

assistant = client.beta.assistants.create(
  tools=[{"type": "retrieval"}],

thread = client.beta.threads.create()

message = client.beta.threads.messages.create(,

run = client.beta.threads.runs.create(,,

messages = client.beta.threads.messages.list(

message = client.beta.threads.messages.retrieve(,

message_content = message.content[0].text
annotations = message_content.annotations
annotations #This is always a blank list
1 Like

getting empty results as well. hopefully this is addressed soon.

I am having this same issue. The response string comes in with the annotations like this:


But the message object returned from the api has an empty annotations array.

1 Like

Same empty array here… any updates fromn thew documentation?

So far the annotation results still are unpredictable. We have seen this issue consistently on our tests. For those following this thread, there is more information about how to improve the chances of your annotations working well here:

1 Like