GenerateContentConfig

public abstract class GenerateContentConfig extends JsonSerializable

Optional model configuration parameters.

For more information, see `Content generation parameters `_.

Constructors

Link copied to clipboard
public void GenerateContentConfig()

Types

Link copied to clipboard
public abstract class Builder
Builder for GenerateContentConfig.

Properties

Link copied to clipboard
public final static String MAX_READ_LENGTH_PROPERTY
System property to override the default max JSON string length (20MB) in read constraints.

Functions

Link copied to clipboard
public abstract Optional<Boolean> audioTimestamp()
If enabled, audio timestamp will be included in the request to the model.
Link copied to clipboard
The configuration for automatic function calling.
Link copied to clipboard
Instantiates a builder for GenerateContentConfig.
Link copied to clipboard
public abstract Optional<String> cachedContent()
Resource name of a context cache that can be used in subsequent requests.
Link copied to clipboard
public abstract Optional<Integer> candidateCount()
Number of response variations to return.
Link copied to clipboard
Enables enhanced civic answers.
Link copied to clipboard
public abstract Optional<Float> frequencyPenalty()
Positive values penalize tokens that repeatedly appear in the generated text, increasing the probability of generating more diverse content.
Link copied to clipboard
public static GenerateContentConfig fromJson(String jsonString)
Deserializes a JSON string to a GenerateContentConfig object.
Link copied to clipboard
@InternalApi()
public static T fromJsonNode<T extends JsonSerializable>(JsonNode jsonNode, Class<T> clazz)
Deserializes a JsonNode to an object of the given type.
Link copied to clipboard
@InternalApi()
public static T fromJsonString<T extends JsonSerializable>(String jsonString, Class<T> clazz)
Deserializes a Json string to an object of the given type.
Link copied to clipboard
public abstract Optional<HttpOptions> httpOptions()
Used to override HTTP request options.
Link copied to clipboard
public abstract Optional<ImageConfig> imageConfig()
The image generation configuration.
Link copied to clipboard
public abstract Optional<Map<String, String>> labels()
Labels with user-defined metadata to break down billed charges.
Link copied to clipboard
public abstract Optional<Integer> logprobs()
Number of top candidate tokens to return the log probabilities for at each generation step.
Link copied to clipboard
public abstract Optional<Integer> maxOutputTokens()
Maximum number of tokens that can be generated in the response.
Link copied to clipboard
If specified, the media resolution specified will be used.
Link copied to clipboard
Settings for prompt and response sanitization using the Model Armor service.
Link copied to clipboard
Configuration for model selection.
Link copied to clipboard
public static ObjectMapper objectMapper()
Link copied to clipboard
public abstract Optional<Float> presencePenalty()
Positive values penalize tokens that already appear in the generated text, increasing the probability of generating more diverse content.
Link copied to clipboard
public abstract Optional<Object> responseJsonSchema()
Optional.
Link copied to clipboard
public abstract Optional<Boolean> responseLogprobs()
Whether to return the log probabilities of the tokens that were chosen by the model at each step.
Link copied to clipboard
public abstract Optional<String> responseMimeType()
Output response mimetype of the generated candidate text.
Link copied to clipboard
public abstract Optional<List<String>> responseModalities()
The requested modalities of the response.
Link copied to clipboard
public abstract Optional<Schema> responseSchema()
The `Schema` object allows the definition of input and output data types.
Link copied to clipboard
Configuration for model router requests.
Link copied to clipboard
Safety settings in the request to block unsafe content in the response.
Link copied to clipboard
public abstract Optional<Integer> seed()
When ``seed`` is fixed to a specific number, the model makes a best effort to provide the same response for repeated requests.
Link copied to clipboard
public abstract Optional<ServiceTier> serviceTier()
The service tier to use for the request.
Link copied to clipboard
public static void setMaxReadLength(int maxReadLength)
Overrides the default maximum JSON string length (20MB) for the JSON parser.
Link copied to clipboard
If true, the raw HTTP response will be returned in the 'sdk_http_response' field.
Link copied to clipboard
public abstract Optional<SpeechConfig> speechConfig()
The speech generation configuration.
Link copied to clipboard
public abstract Optional<List<String>> stopSequences()
List of strings that tells the model to stop generating text if one of the strings is encountered in the response.
Link copied to clipboard
public static JsonNode stringToJsonNode(String string)
Converts a Json string to a JsonNode.
Link copied to clipboard
public abstract Optional<Content> systemInstruction()
Instructions for the model to steer it toward better performance.
Link copied to clipboard
public abstract Optional<Float> temperature()
Value that controls the degree of randomness in token selection.
Link copied to clipboard
The thinking features configuration.
Link copied to clipboard
Creates a builder with the same values as this instance.
Link copied to clipboard
public String toJson()
Serializes the instance to a Json string.
Link copied to clipboard
public static JsonNode toJsonNode(Object object)
Serializes an object to a JsonNode.
Link copied to clipboard
public static String toJsonString(Object object)
Serializes an object to a Json string.
Link copied to clipboard
public abstract Optional<ToolConfig> toolConfig()
Associates model output to a specific function call.
Link copied to clipboard
public abstract Optional<List<Tool>> tools()
Code that enables the system to interact with external systems to perform an action outside of the knowledge and scope of the model.
Link copied to clipboard
public abstract Optional<Float> topK()
For each token selection step, the ``top_k`` tokens with the highest probabilities are sampled.
Link copied to clipboard
public abstract Optional<Float> topP()
Tokens are selected from the most to least probable until the sum of their probabilities equals this value.