Overview
When building a chat interface using RAG (Retrieval-augmented generation) with OpenAI’s Assistants API, I used the following repository.
https://github.com/openai/openai-assistants-quickstart
A modification was needed regarding the handling of citation, so I am documenting it here as a memo.
Background
I used the above repository to try RAG with OpenAI’s Assistants API.
With the default settings, citation markers like “4:13†” were displayed as-is, as shown below.

Solution
I modified annotateLastMessage as follows. By changing file_path to file_citation, the citation markers could be replaced.
As an example, the following replaces them with links to the File API.
As a result, links are now displayed as shown below.

Summary
The replacement content can be changed depending on your purpose. I hope this serves as a helpful reference.