do you want to totally change the instructions in the next run? or you just want to append to the instructions? you can do both. use the following properties when creating run:
This method is for when I have a thread
private async createStreamRun(
threadId: string,
assistantId: string,
infoRelations: any,
) {
const streamRun = await this.client.beta.threads.runs.create(threadId, {
assistant_id: assistantId,
stream: true,
instructions: instructions,
});
return streamRun;
}
This method is for when there is no thread and it is the first message
Create dynamic instructions by adapting to context with NLP, using flexible templates, leveraging machine learning, gathering feedback, personalizing content, and continuously refining through testing.
when you add new message, you call run. for each run, you can change the instruction or append to the instruction using the properties i wrote beforehand.
to illustrate:
assistant main instruction: you are a cat
user: what is your name?
first run, additional instruction: your name is garfield
you need to keep the additional_instructions when calling runs. otherwise, it will fall back to just the main instructions. the effect of using instructions and additional_instructions when calling run is only for that run. it will not persist to the next run.
We’re storing what we refer to as “AI functions” in our RAG database, implying that when users says for instance “Send email”, it will match towards a “Send email” RAG record, providing context instructions to the LLM, resulting in that we can arguably dynamically “change” instructions we’re sending based upon the prompting of the user.
The code is proprietary, but you can probably figure out its rough mechanics from the following article.