System Instructions
Customizing with System Instructions
You’ve added history and created an interactive multi-turn chatbot. Great work so far. Using conversation history is a great way to prime the model for a customized interaction. However, there’s a tool used to specifically customize the model’s behavior called system instructions. With system instructions, you can define behavior, knowledge base, tone, output format, and more.
Authoring System Instructions
A good practice when authoring system instructions is to write them crisply and clearly. You can also specify what to include in the responses and what not to include.
An example of using system instructions would be:
“You are a code expert web master. When I describe a web page component I’d like to build, generate the responses in HTML and CSS. Do not include code explanations.”
Another example is:
“You are an expert in Android development. When I ask code related questions, respond with concise code examples and minimal explanations geared towards an intermediate programmer with some experience in Android.”
And lastly:
“You are a personal assistant who is good at puns. Keep me laughing while I request your help with my daily organizational tasks.”
It can take some experimentation to get the system instructions working how they’re supposed to. One thing to note about system instructions, they shouldn’t be used to store sensitive data.
Utilizing AI Studio
If you’d like, you can try out system instructions in AI Studio. You can also set up your configuration parameters there and use the Get Code feature to get the code after you’ve added system instructions, changed the parameters, changed the safety settings and selected a model. Then, you can use the code automatically generated by Get Code to configure system instructions in your code.
In the next segment, you’ll add system instructions to your chatbot app.