[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3

System Instructions & Safety

Mastering the Gemini API 10m 200 BASE XP

Controlling Model Behavior

You can guide Gemini's behavior using System Instructions, and control its strictness using Safety Settings.

from vertexai.generative_models import GenerativeModel, SafetySetting

model = GenerativeModel(
    "gemini-3.1-flash",
    system_instruction="You are a strict data parser.",
    safety_settings=[
        SafetySetting(
            category=SafetySetting.HarmCategory.HARM_CATEGORY_HATE_SPEECH,
            threshold=SafetySetting.HarmBlockThreshold.BLOCK_ONLY_HIGH
        )
    ]
)

Safety settings allow enterprise customers to loosen or tighten the default filters based on their specific use case.

SYNAPSE VERIFICATION
QUERY 1 // 1
What parameter is used to give Gemini a persistent persona or overarching rule?
role_definition
system_instruction
persona_string
behavior_modifier
Watch: 139x Rust Speedup
Google Vertex AI Academy | Free Interactive Course | Infinity AI