How to pass parameter to Asistant's "System Instruction"

hi there. i have created an Assistant for use as a AI tutor. In the system instruction I want to pass a parameter. For e.g. I want my tutor to teach a history lesson, so my system instruction runs as “You are an AI tutor. Help the user learn about the history of France”, this is ok as its heard-coded.

But I would like the user to decide which is their area of interest at the click of a button or by selecting an item on the user interface.

Is this possible and how could it be done?

Thanks all in advance.

1 Like

Hi there and welcome to the Forum!

Yes, this is technically possible.

You need to provide options i.e. the different subjects, to the user in the front-end interface. The user can click a button or select an item from a dropdown or other input method. Once the user selects their option, you can pass this selection as a parameter to the back-end via an API call or function. The back-end will then adjust the system instruction dynamically based on the user’s choice.

1 Like

You asked for a parameter, let’s give that parameter.

To clarify:

  • You are using Assistants;
  • The Assistant you create has a relatively permanent instruction.
  • You would not want to alter the Assistant to conform to a particular user.
  • Instead, you would pass a run parameter called additional_instructions
  • additional_instructions is appended onto the system message that run.

Since assistants are free to create lots of, and threads are not connected to any particular assistant ID after finished, you can make multiple experts, and give a different assistant ID to every run, depending on which specialization is chosen in the user interface.

1 Like

Thank you, that makes sense. Will give it a try and update here if any issues.

1 Like

hi,
I have the same challenge and would like to get a help here - thanks in advance.
I have a full questionnaire for the user. How the answers can personalize the conversation with the assistance? what should be done at the back-end and what should be done in the prompt, if at all?

1 Like

Hi, where do we set the additional_instructions in the API call from client?