Remove 【35†source】from Assistant Response

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.