Disable references in the Assistant API response

Hello,

I am working with the Assitant API and, as it happens in the Playground, GPT provides in the response a link to the reference (in case a reference document has been added for the Assitant).

My question is if there is some parameter in the Assitant API that disables the appearance of these links to the reference, or some way to read only the part that does not include the reference.

I don’t want to have to ‘clean’ the answer to remove that part. I would like there to be some parameter that would do this for me.

Thanks in advance.

1 Like

No.

https://platform.openai.com/docs/api-reference/assistants/createAssistant

2 Likes

Hi and welcome to the Developer Forum!

I do not know of a parameter to do that, the only way I know of so far is to use code after the event:

import re

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

# Use regex to remove source citations
cleaned_text = re.sub('【.*?†source】', '', message_text)
2 Likes

Thank you.

There is no way to do it through instructions in the prompt?

Thanks

I wanted to have to avoid doing it by code :frowning:

Thank you.

You can certainly try, but you need to remember that these are stochastic models. Even if you did somehow suppress this behaviour it would not be guaranteed to work every time and any future tweaks to the model could render it suddenly ineffective.

I understand the desire to have the cake come out of the oven fully-baked, so to speak, but the reality is the only way to ensure the results are what you want them to be is to do the work of post-processing the responses.

1 Like

The only effective way is to remove it from the response using the code

Can you provide instructions for newbies on where and how to place the code “to use code after the event”?