Best way to carry contextual data through an assistant thread?

I’m working on an assistant that would ideally have a set of “context” available to it on every run. This context would contain personal information/data among other things. The context would likely be slightly modified after each run. I’m trying to figure out the best way to go about this with regard to assistants.

Assistant files wouldn’t make sense because this would be “per user”.

Adding the full context to the user message before each run would just create a giant thread full of repetition.

Maybe message files? But would this still have the same problem as including the context in the user in the message directly? I’m not clear if the message files are persisted in the threads.

Something else? Maybe not really doable in the assistant/thread framework?

Thanks for any help/ideas.

2 Likes

@shiftynick, have you looked at “additional_instructions” property of the Create Run endpoint?

I had a similar requirement where I wanted to dynamically load the most up-to-date instructions and data into the Assistant Context every time new thread is initiated. Right after new thread creation, I would create a Thread Run with Instruction: “Run getContextInfo function. On success, respond by saying ‘Data received.’”. The Run then immediately goes into “requires_action” status and under “required_action” there would be “getContextInfo” function call listed. I would then Submit tool outputs to run
and send in all of the data that I want to be pre-set in the Assistant Context before any User message is received.

In my Assistant configuration, Instructions only contain global directives on how to behave, what tone to use, what info can be used as base for responses etc. Which makes a lot of sense and nicely separates the Behavioural Instructions from the Data that is the semantic source of the dialog with the User.

I also have other functions defined on the Assistant to fetch user-specific data when needed. But even without calling these specific functions, Assistant is already aware of a lot and can have a very meaningful conversation with the user.

4 Likes