Updating file ids associated with an assistant that has already been created

Hello all! I am wondering how to go about adding a newly uploaded file to an already created assistant via the python api. Here is what I have:

client.beta.assistants.update(
assistant_id=assistant_id,
file_ids=response
)

in this instance, the user has input which assistant id they would like to add this new file to and has also specified the file id they would like to add. The assistant was already created with files that will be staying associated with this assistant as well. The idea is to update these files weekly such that outdated files will be removed and newer updated files will be replacing them. If any of this is too confusing or you need more elaboration let me know.

1 Like

@miller253111 Did you get answer related to this, or should need create a new assistant and delete the old one.

I also have this problem and can’t seem to get an answer. Anyone have any thoughts? --Thx

This script will override the values already in the assistant:

		const response = await fetch(`https://api.openai.com/v1/assistants/${assistant_id}`,
			{
			method: 'POST',
			headers: {
				'Content-Type':  'application/json',
				'OpenAI-Beta':   'assistants=v1',
				'Authorization': `Bearer ${apiKey}`
				},
			body: JSON.stringify({ instructions: instructions , name: assistant_name , model: "gpt-4-turbo-preview", tools: [{ "type": "retrieval" }] , 			 file_ids: [file_id] })