The single call you'll write 10,000 times
client.models.generate_content(model=..., contents=..., config=...) is the heart of the SDK. contents can be a plain string (the SDK wraps it for you), a list of strings, a list of Content objects, or anything in between — the SDK normalizes.
Configuring with GenerateContentConfig
Every knob from the previous lesson (system_instruction, temperature, max_output_tokens, etc.) lives on types.GenerateContentConfig. You can also pass a plain dict — the SDK converts.
What the response actually is
The return value is a GenerateContentResponse. The fields you'll touch most often:
response.text— concatenated text across all parts. The 90% case.response.parts— the raw list. Use this when you need non-text parts (images, function calls).response.function_calls— populated when the model invoked a tool.response.parsed— the deserialized object when you used JSON mode with a Pydantic schema.response.candidates[0].finish_reason— the stop reason.response.usage_metadata— token counts for billing.
The first thing to check
Whenever a Gemini call comes back, the first line of your handler should look at finish_reason. If it's not STOP, your response.text is unreliable — it might be empty (filtered) or truncated (max tokens hit) or recitation-blocked.