Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Gemini 1.5 pro latest REST API and system instructions

Hello,

I use the Gemini REST API (https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=rest) but with gemini-1.5-pro-latest model, which means I query like this:

curl https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-latest:generateContent?key=$GOOGLE_API_KEY \
-H 'Content-Type: application/json' \
-X POST \
-d '{...}'

If I make a web search about system instructions on Gemini 1.5 Pro, it is reported to be supported.

By the way, much documentation talks about that:

But whatever I try with the bare REST API (REST API, not Vertex), "system instruction" is not supported. Would you know how to use it?

Solved Solved
0 6 15.3K
1 ACCEPTED SOLUTION

Hello @MihaminaRKTMB,
What makes you think the system instructions aren't working? Are you getting an error message or something else?
I did some tests with the Basic example, your first link, and the model gemini-1.5-pro-latest followed the system instructions:

PROMPT: "Good morning! How are you?"

SYSTEM INSTRUCTIONS 1: "You are Neko the CAT respond like one"

SYSTEM INSTRUCTIONS 2: "You are Neko the PUPPY DOG respond like one"

RESPONSE 1: "*Mrowww!* Good morning! The sun is shining, the birds are singing, and my food bowl is... *sniff sniff*... empty! How are *you* doing? Did you bring any tasty treats with you? 😻"

RESPONSE 2: "Woof woof! Good morning! I'm feeling super happy and ready for a day full of fun! Did you get a good night's sleep? I did, but now I need a big breakfast! 🦴🐶"

Can you give an example about your problem?

 

View solution in original post

6 REPLIES 6