Understand prompt design

When you call the Gemini API, you send along a prompt with your request. By carefully crafting these prompts, you can influence the model to generate output specific to your needs. Prompts can contain questions, instructions, contextual information, few-shot examples, and partial input for the model to complete or continue.

Learn about prompt design in the Google Cloud documentation:

Other options to control content generation

  • Configure model parameters to control how the model generates a response. These parameters include max output tokens, temperature, topK, and topP.
  • Use safety settings to adjust the likelihood of getting responses that may be considered harmful, including hate speech and sexually explicit content.
  • Set system instructions to steer the behavior of the model. This feature is like a "preamble" that you add before the model gets exposed to any further instructions from the end user.
  • Pass a response schema along with the prompt to specify a specific output schema. This feature is most commonly used when generating JSON output, but it can also be used for classification tasks (like when you want the model to use specific labels or tags).