tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Google Gemini API > Gemini API System Instructions and Configuration

Gemini API System Instructions and Configuration

Author: Venkata Sudhakar

System instructions are the foundation of any production Gemini application. They define the persona, scope, tone, and constraints of your AI - turning a general-purpose model into a specialist that behaves consistently for your specific business context. A well-crafted system instruction is the difference between a chatbot that answers any question in any way and one that reliably stays on topic, uses your brand voice, and respects your business rules. Every production Gemini deployment should start with a careful system instruction design before writing any other code.

In the google-genai SDK, system instructions are passed as system_instruction in GenerateContentConfig. This config object also controls generation parameters: temperature (creativity vs consistency), max_output_tokens (response length limit), top_p and top_k (token sampling strategy), stop_sequences (tokens that end generation), and candidate_count (number of response options). Safety settings let you configure content filtering thresholds per harm category. Understanding these parameters lets you precisely tune model behaviour for your specific use case.

The below example builds three different configurations for a large retail chain - a customer service bot (consistent and safe), a product copywriter (creative), and an internal data analyst (precise and structured) - showing how the same model behaves very differently based on configuration.


Testing the same topic across all three configurations to see how behaviour differs,


It gives the following output showing how configuration shapes behaviour,

=== CUSTOMER SERVICE BOT ===
Thank you for your question! For a college student looking for a laptop
under Rs 50,000, ShopMax has some excellent options. I would need to verify
current availability and exact pricing for you, but popular choices in this
range include models from Lenovo IdeaPad, HP Pavilion, and Acer Aspire series.
Could you tell me the primary use - studies, coding, or general use? That
will help me point you to the best option for your needs.
Is there anything else I can help you with?

=== PRODUCT COPYWRITER ===
Power Your World with the Samsung Galaxy Tab A9+
Meet the tablet that keeps up with your life. Whether you are streaming your
favourite shows, crushing your workload, or staying connected with family,
the 10.9-inch display delivers stunning visuals while 8GB RAM ensures zero
lag. 128GB storage means your photos, apps, and files always have a home.
Built for India's students, professionals, and families.
Shop Now at Rs 24,999 and experience the Samsung difference.

=== DATA ANALYST ===
- Total Revenue: Rs 5.85Cr vs Rs 7Cr target = 83.6% achievement
- Revenue Gap: Rs 1.15Cr (16.4% below target)
- Top Category: Phones (Rs 1.8Cr, 890 units, avg Rs 20,225/unit)
- Highest Margin Likely: Laptops (Rs 2.1Cr, 450 units, avg Rs 46,667/unit)
- Underperformer: Tablets (Rs 0.45Cr - only 7.7% of total revenue)
- DATA FLAG: Tablet avg unit price Rs 2,500 appears unusually low for tablets
  - verify if this is accessories bundled with tablets or a data entry error

# Same model, same question type - completely different outputs
# Temperature 0.0 vs 0.8 alone changes from precise analysis to creative copy

System instruction design checklist for production: define the persona name and company explicitly so the model answers "in character". State the scope clearly with both what is allowed and what is not - models respond better to explicit exclusions than vague boundaries. Set the tone with specific adjectives (warm, precise, concise) rather than abstract goals (be helpful). Include one or two example response patterns directly in the system instruction for edge cases you have seen in testing. Store system instructions in a config file or database so non-engineers can update them without code changes - the system instruction is business logic, not just code.


 
  


  
bl  br