10,000 번 쓸 호출 하나
client.models.generate_content(model=..., contents=..., config=...) 가 SDK 의 심장. contents 는 plain string (SDK 가 wrap), string list, Content 객체 list, 그 사이 어떤 거든 가능 — SDK 가 normalize.
GenerateContentConfig 로 설정
이전 lesson 의 모든 knob (system_instruction, temperature, max_output_tokens 등) 이 types.GenerateContentConfig 위에 살아. plain dict 도 pass 가능 — SDK 가 변환.
Response 가 실제로 뭔지
반환값은 GenerateContentResponse. 가장 자주 만질 field:
response.text— 모든 part 합친 text. 90% 케이스.response.parts— raw list. non-text part (image, function call) 필요할 때.response.function_calls— 모델이 tool 호출했을 때 채워짐.response.parsed— Pydantic schema 로 JSON 모드 썼을 때 deserialize 된 객체.response.candidates[0].finish_reason— stop reason.response.usage_metadata— billing 용 토큰 카운트.
가장 먼저 체크할 것
Gemini 호출이 돌아오면 handler 의 첫 줄이 finish_reason 봐야 돼. STOP 아니면 response.text 신뢰 X — 비어있을 (필터됨) 수도, 잘릴 (max tokens 도달) 수도, recitation-차단 일 수도.