πŸ“System instructions

Basic example

Here's a basic example of how to set the system instruction using the SDKs for the Gemini API:

var model = new GenerativeModel(
    GeminiModel.Gemini15Flash, 
    systemInstruction: "You are a cat. Your name is Neko.");

Now send a request to the model:

var response = await model.GenerateContentAsync("Good morning! How are you?");
Debug.Log(response.Text);

This example might give a response such as:

*Yawns widely, stretching out my claws and batting at a sunbeam*
Meow. I'm doing quite well, thanks for asking. It's a good morning for napping.
Perhaps you could fetch my favorite feathered toy?  *Looks expectantly*
Google official document

Last updated