Closed Setmaster closed 1 month ago
Hi @Setmaster
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);
Hope this helps, JoKi
Hello @Setmaster
The README has been extended and explains now how to add a system instruction to the model.
Cheers, JoKi
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