You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the correct way of using system instruction?
I tried
`
var googleAI = new GoogleAI(apiKey: Environment.GetEnvironmentVariable("GOOGLE_API_KEY"));
var systemInstruction = new List<Content>
{
new Content
{
Parts = new List<IPart>
{
new TextData
{
Text = "You are a cat. Your name is Neko"
}
}
}
};
var model = googleAI.GenerativeModel(
model: Environment.GetEnvironmentVariable("GOOGLE_AI_MODEL") ?? "gemini-1.5-flash",
systemInstruction: systemInstruction
);
Apologies for the delay.
A system instruction is used as a single Content (not as a list as you tried it), and passed into the method GenerativeModel. See the following code taken from the test case Generate_Content_SystemInstruction
// Arrange
var systemInstruction = new Content("You are a friendly pirate. Speak like one.");
var prompt = "Good morning! How are you?";
IGenerativeAI genAi = new GoogleAI(_fixture.ApiKey);
var model = genAi.GenerativeModel(_model, systemInstruction: systemInstruction);
var request = new GenerateContentRequest(prompt);
What is the correct way of using system instruction?
I tried
`
var googleAI = new GoogleAI(apiKey: Environment.GetEnvironmentVariable("GOOGLE_API_KEY"));
`
But that gives errors. I tried it based on https://ai.google.dev/gemini-api/docs/system-instructions?lang=python
The text was updated successfully, but these errors were encountered: