Courseiva

Generative AI Leader Practice Question: Techniques to Improve Generative AI Model Output

A developer is using the Gemini API to generate code snippets. They notice the outputs often contain deprecated API calls. Which parameter adjustment or prompt strategy would most effectively encourage the model to use current APIs?

⚠ Common exam trap

This question tests the misconception that adjusting sampling parameters (like temperature or top-p) or providing a single example can reliably enforce content constraints, when in fact system instructions are the designed mechanism for persistent behavioral guidance in production-grade APIs.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Add a system instruction specifying 'Use the most recent API version and avoid deprecated functions.'

Adding a system instruction that explicitly directs the model to 'Use the most recent API version and avoid deprecated functions' directly influences the model's behavior at the prompt level. The Gemini API supports system instructions that act as persistent, high-level guidance, steering the model toward preferred output patterns—in this case, avoiding deprecated API calls. This is the most effective and direct method to enforce current API usage without altering sampling parameters or relying on limited examples.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Add a system instruction specifying 'Use the most recent API version and avoid deprecated functions.'

    Why this is correct

    A system instruction sets persistent behavioural guidance that conditions every response, so explicitly directing the model toward current API versions and away from deprecated functions steers generation more reliably than per-request wording. This directly targets the deprecated-call pattern observed in the outputs.

  • ✗

    Set top-p to 0.5 to reduce output diversity

    Why it's wrong here

    Top-p controls nucleus sampling breadth, not factual currency; lowering it narrows token choice but cannot inject knowledge of newer API versions. It is tempting because it reduces erratic output, yet it would be the right lever when you need deterministic, focused phrasing rather than updated API references.

  • ✗

    Provide one few-shot example of a correct API call

    Why it's wrong here

    A single few-shot example demonstrates one correct call but does not reliably override the model's tendency toward deprecated patterns across varied snippets. Few-shot prompting suits teaching a narrow output format or style, whereas grounding with current documentation or retrieval better enforces up-to-date APIs.

  • ✗

    Set temperature to 1.5 to increase creativity

    Why it's wrong here

    Raising temperature to 1.5 increases sampling randomness, producing more varied and less deterministic output rather than steering the model toward current APIs; deprecated calls may even increase. Higher temperature suits brainstorming or creative writing, not factual accuracy on version-specific library details.

About these practice questions

This Generative AI Leader question is part of Courseiva's 1,008-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This Generative AI Leader practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Generative AI Leader exam.