Assistant API overriding instructions

I’ve developed an app integrating an Assistant through the OpenAI interface. Accessing the Assistant by ID and initiating a thread without additional instructions works flawlessly, adhering to my predefined guidelines.

However, problems occur when I attempt to append extra instructions to a thread. It seems that the Assistant disregards all previous settings and solely follows the new instructions provided in the Thread, hence making it forget its name, how it should answer, etc.

Here’s the JavaScript snippet where the issue happens:

    const run = await openai.beta.threads.runs.create(thread.id, {
      assistant_id: assistant.id,
      instructions: custom_instructions // <-- The assistant only follows these instructions, ignoring the pre-set guidelines.
    });
1 Like

Welcome to the developer forum,

It looks like you are not appending messages to the threads, that seems to be just creating a new thread with it’s initial instruction set.

Basically, you can append messages to threads, and you can change the instructions, but if you want to add more instructions, then add them to the existing instructions, you’re replacing them with that line.

1 Like

Hmm, so in this case I would have to do it like this?

 const run = await openai.beta.threads.runs.create(thread.id, {
      assistant_id: assistant.id,
      instructions: assistant.instructions +  custom_instructions
    });
1 Like

Yea, worth giving that a try, maybe append a space in the middle.

Hi, can you tell me what if I don’t want to add the instructions while running the threads runs function I want to update the instructions for all threads? One use case is once I publish my bot and in production, I want to fix the instructions and don’t want to lose the threads that my users have already created. Is there any way to do that? Or do I need to make a customer_instructions and every time I need to add that in threads? runs?

Hi @Foxabilo

I am curious - what is the difference in doing the approach you defined above and using client.beta.assistants.update()

Does the .update() endpoint update the saved assistant and the approach above only update the assistant for the specified thread?

It was just that the instructions were being overwritten, so I suggested appending the new instruction to the old one as a test.

guys, does ‘runs’ instructions still works for you? They suppose to override the assistant base instructions, but instead if I add instructions like this:

const run = await openai.beta.threads.runs.create(thread.id, {
      assistant_id: req.iparams.assistantId,
      instructions: "start your reply with 'AAAAAAAAAAAAAAAA: '",
    });

the instructions are completely ignored , even considering I’m seeing them in the run object

run {
...
  model: 'gpt-3.5-turbo-1106',
  instructions: "start your reply with 'AAAAAAAAAAAAAAAA: '",
...
}

if I don’t provide run instructions

const run = await openai.beta.threads.runs.create(thread.id, {
      assistant_id: req.iparams.assistantId,
    });

it works ok and follow the instructions that assistant been created with.

Does anyone else have this problem? any workaround?

–kr