Remove 【35†source】from Assistant Response


When using retrieval on Assistants my answers are returned with a source annotation, eg: 【35†source】… is it possible for the response to be received without such annotation? I’ve tried prompting it not to send it back but it doesn’t seem to work?


Same problem here… I have added in the prompt not to cite anything. Sometimes the output is good sometimes not.

Here is OpenAI code example for dealing with annotations, adding them as footnotes.

If you want them gone, you can just eliminate the contents of response message within the Japanese brackets with a regex or pattern match in your code.

Here’s some quickie code for an idea.

import re

message_text = ("This is a sample text【9†source】 with source "
"tags using annotations【10†source】and some other content.")

# Use re.sub() to remove the matched source
# tags and their contents
pattern = r'【\d+†source】'
cleaned_text = re.sub(pattern, '', message_text)


You might need to close up extra spaces depending on where they appear if your renderer doesn’t already not show extra white space.


Thanks for the help! Much appreciated!

Wow, seriously, thank you, it helped me, blessings

1 Like

For newbies, where and how do you place this code to delete the annotations?

1 Like

how are you using assistants? I imagine some no-code tool?

you put the text transformation anywhere after you’ve received your response :thinking:

1 Like

Hi @_j ,
thanks for your answer, it worked in the first conversation, but when I continue the conversation it can’t replace it what should I do?
I’m using gradio for the UI.