You can control content generation in a variety of ways depending on your use case and the level of control that you need.
Prompt design
Learn about prompt design so that you can influence the model to generate output specific to your needs.
For example, learn how to provide relevant information associated with the task in a structured way.
Model parameters
Configure model parameters to control how the model generates a response. These parameters can include max output tokens, temperature, topK, and topP.
For example, you can adjust the temperature
parameter to control the degree of
randomness in responses.
Safety settings
Use safety settings to adjust the likelihood of getting responses that may be considered harmful. These settings can help you with controlling output for possible hate speech, harassment, sexual explicitness, and dangerous content.
For example, you can block responses that promote or enable access to harmful goods, services, and activities.
System instructions
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.
For example, you can tell the model to return responses as if it were a pirate or to return responses in a specific format.
Structured output using response schema
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).