#[non_exhaustive]pub struct GenerationConfig {Show 18 fields
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<f32>,
pub candidate_count: Option<i32>,
pub max_output_tokens: Option<i32>,
pub stop_sequences: Vec<String>,
pub response_logprobs: Option<bool>,
pub logprobs: Option<i32>,
pub presence_penalty: Option<f32>,
pub frequency_penalty: Option<f32>,
pub seed: Option<i32>,
pub response_mime_type: String,
pub response_schema: Option<Schema>,
pub response_json_schema: Option<Value>,
pub routing_config: Option<RoutingConfig>,
pub speech_config: Option<SpeechConfig>,
pub thinking_config: Option<ThinkingConfig>,
pub image_config: Option<ImageConfig>,
/* private fields */
}llm-utility-service or prediction-service only.Expand description
Generation config.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.temperature: Option<f32>Optional. Controls the randomness of predictions.
top_p: Option<f32>Optional. If specified, nucleus sampling will be used.
top_k: Option<f32>Optional. If specified, top-k sampling will be used.
candidate_count: Option<i32>Optional. Number of candidates to generate.
max_output_tokens: Option<i32>Optional. The maximum number of output tokens to generate per message.
stop_sequences: Vec<String>Optional. Stop sequences.
response_logprobs: Option<bool>Optional. If true, export the logprobs results in response.
logprobs: Option<i32>Optional. Logit probabilities.
presence_penalty: Option<f32>Optional. Positive penalties.
frequency_penalty: Option<f32>Optional. Frequency penalties.
seed: Option<i32>Optional. Seed.
response_mime_type: StringOptional. Output response mimetype of the generated candidate text. Supported mimetype:
text/plain: (default) Text output.application/json: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.
response_schema: Option<Schema>Optional. The Schema object allows the definition of input and output
data types. These types can be objects, but also primitives and arrays.
Represents a select subset of an OpenAPI 3.0 schema
object.
If set, a compatible response_mime_type must also be set.
Compatible mimetypes:
application/json: Schema for JSON response.
response_json_schema: Option<Value>Optional. Output schema of the generated response. This is an alternative
to response_schema that accepts JSON Schema.
If set, response_schema must be omitted, but response_mime_type is
required.
While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported:
$id$defs$ref$anchortypeformattitledescriptionenum(for strings and numbers)itemsprefixItemsminItemsmaxItemsminimummaximumanyOfoneOf(interpreted the same asanyOf)propertiesadditionalPropertiesrequired
The non-standard propertyOrdering property may also be set.
Cyclic references are unrolled to a limited degree and, as such, may only
be used within non-required properties. (Nullable properties are not
sufficient.) If $ref is set on a sub-schema, no other properties, except
for than those starting as a $, may be set.
routing_config: Option<RoutingConfig>Optional. Routing configuration.
speech_config: Option<SpeechConfig>Optional. The speech generation config.
thinking_config: Option<ThinkingConfig>Optional. Config for thinking features. An error will be returned if this field is set for models that don’t support thinking.
image_config: Option<ImageConfig>Optional. Config for image generation features.
Implementations§
Source§impl GenerationConfig
impl GenerationConfig
pub fn new() -> Self
Sourcepub fn set_temperature<T>(self, v: T) -> Self
pub fn set_temperature<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_temperature<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_temperature<T>(self, v: Option<T>) -> Self
Sets or clears the value of temperature.
§Example
let x = GenerationConfig::new().set_or_clear_temperature(Some(42.0));
let x = GenerationConfig::new().set_or_clear_temperature(None::<f32>);Sourcepub fn set_or_clear_top_p<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_top_p<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_top_k<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_top_k<T>(self, v: Option<T>) -> Self
Sourcepub fn set_candidate_count<T>(self, v: T) -> Self
pub fn set_candidate_count<T>(self, v: T) -> Self
Sets the value of candidate_count.
§Example
let x = GenerationConfig::new().set_candidate_count(42);Sourcepub fn set_or_clear_candidate_count<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_candidate_count<T>(self, v: Option<T>) -> Self
Sets or clears the value of candidate_count.
§Example
let x = GenerationConfig::new().set_or_clear_candidate_count(Some(42));
let x = GenerationConfig::new().set_or_clear_candidate_count(None::<i32>);Sourcepub fn set_max_output_tokens<T>(self, v: T) -> Self
pub fn set_max_output_tokens<T>(self, v: T) -> Self
Sets the value of max_output_tokens.
§Example
let x = GenerationConfig::new().set_max_output_tokens(42);Sourcepub fn set_or_clear_max_output_tokens<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_max_output_tokens<T>(self, v: Option<T>) -> Self
Sets or clears the value of max_output_tokens.
§Example
let x = GenerationConfig::new().set_or_clear_max_output_tokens(Some(42));
let x = GenerationConfig::new().set_or_clear_max_output_tokens(None::<i32>);Sourcepub fn set_stop_sequences<T, V>(self, v: T) -> Self
pub fn set_stop_sequences<T, V>(self, v: T) -> Self
Sets the value of stop_sequences.
§Example
let x = GenerationConfig::new().set_stop_sequences(["a", "b", "c"]);Sourcepub fn set_response_logprobs<T>(self, v: T) -> Self
pub fn set_response_logprobs<T>(self, v: T) -> Self
Sets the value of response_logprobs.
§Example
let x = GenerationConfig::new().set_response_logprobs(true);Sourcepub fn set_or_clear_response_logprobs<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_response_logprobs<T>(self, v: Option<T>) -> Self
Sets or clears the value of response_logprobs.
§Example
let x = GenerationConfig::new().set_or_clear_response_logprobs(Some(false));
let x = GenerationConfig::new().set_or_clear_response_logprobs(None::<bool>);Sourcepub fn set_logprobs<T>(self, v: T) -> Self
pub fn set_logprobs<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_logprobs<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_logprobs<T>(self, v: Option<T>) -> Self
Sourcepub fn set_presence_penalty<T>(self, v: T) -> Self
pub fn set_presence_penalty<T>(self, v: T) -> Self
Sets the value of presence_penalty.
§Example
let x = GenerationConfig::new().set_presence_penalty(42.0);Sourcepub fn set_or_clear_presence_penalty<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_presence_penalty<T>(self, v: Option<T>) -> Self
Sets or clears the value of presence_penalty.
§Example
let x = GenerationConfig::new().set_or_clear_presence_penalty(Some(42.0));
let x = GenerationConfig::new().set_or_clear_presence_penalty(None::<f32>);Sourcepub fn set_frequency_penalty<T>(self, v: T) -> Self
pub fn set_frequency_penalty<T>(self, v: T) -> Self
Sets the value of frequency_penalty.
§Example
let x = GenerationConfig::new().set_frequency_penalty(42.0);Sourcepub fn set_or_clear_frequency_penalty<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_frequency_penalty<T>(self, v: Option<T>) -> Self
Sets or clears the value of frequency_penalty.
§Example
let x = GenerationConfig::new().set_or_clear_frequency_penalty(Some(42.0));
let x = GenerationConfig::new().set_or_clear_frequency_penalty(None::<f32>);Sourcepub fn set_or_clear_seed<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_seed<T>(self, v: Option<T>) -> Self
Sourcepub fn set_response_mime_type<T: Into<String>>(self, v: T) -> Self
pub fn set_response_mime_type<T: Into<String>>(self, v: T) -> Self
Sets the value of response_mime_type.
§Example
let x = GenerationConfig::new().set_response_mime_type("example");Sourcepub fn set_response_schema<T>(self, v: T) -> Self
pub fn set_response_schema<T>(self, v: T) -> Self
Sets the value of response_schema.
§Example
use google_cloud_aiplatform_v1::model::Schema;
let x = GenerationConfig::new().set_response_schema(Schema::default()/* use setters */);Sourcepub fn set_or_clear_response_schema<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_response_schema<T>(self, v: Option<T>) -> Self
Sets or clears the value of response_schema.
§Example
use google_cloud_aiplatform_v1::model::Schema;
let x = GenerationConfig::new().set_or_clear_response_schema(Some(Schema::default()/* use setters */));
let x = GenerationConfig::new().set_or_clear_response_schema(None::<Schema>);Sourcepub fn set_response_json_schema<T>(self, v: T) -> Self
pub fn set_response_json_schema<T>(self, v: T) -> Self
Sets the value of response_json_schema.
§Example
use wkt::Value;
let x = GenerationConfig::new().set_response_json_schema(Value::default()/* use setters */);Sourcepub fn set_or_clear_response_json_schema<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_response_json_schema<T>(self, v: Option<T>) -> Self
Sets or clears the value of response_json_schema.
§Example
use wkt::Value;
let x = GenerationConfig::new().set_or_clear_response_json_schema(Some(Value::default()/* use setters */));
let x = GenerationConfig::new().set_or_clear_response_json_schema(None::<Value>);Sourcepub fn set_routing_config<T>(self, v: T) -> Selfwhere
T: Into<RoutingConfig>,
pub fn set_routing_config<T>(self, v: T) -> Selfwhere
T: Into<RoutingConfig>,
Sets the value of routing_config.
§Example
use google_cloud_aiplatform_v1::model::generation_config::RoutingConfig;
let x = GenerationConfig::new().set_routing_config(RoutingConfig::default()/* use setters */);Sourcepub fn set_or_clear_routing_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<RoutingConfig>,
pub fn set_or_clear_routing_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<RoutingConfig>,
Sets or clears the value of routing_config.
§Example
use google_cloud_aiplatform_v1::model::generation_config::RoutingConfig;
let x = GenerationConfig::new().set_or_clear_routing_config(Some(RoutingConfig::default()/* use setters */));
let x = GenerationConfig::new().set_or_clear_routing_config(None::<RoutingConfig>);Sourcepub fn set_speech_config<T>(self, v: T) -> Selfwhere
T: Into<SpeechConfig>,
pub fn set_speech_config<T>(self, v: T) -> Selfwhere
T: Into<SpeechConfig>,
Sets the value of speech_config.
§Example
use google_cloud_aiplatform_v1::model::SpeechConfig;
let x = GenerationConfig::new().set_speech_config(SpeechConfig::default()/* use setters */);Sourcepub fn set_or_clear_speech_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<SpeechConfig>,
pub fn set_or_clear_speech_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<SpeechConfig>,
Sets or clears the value of speech_config.
§Example
use google_cloud_aiplatform_v1::model::SpeechConfig;
let x = GenerationConfig::new().set_or_clear_speech_config(Some(SpeechConfig::default()/* use setters */));
let x = GenerationConfig::new().set_or_clear_speech_config(None::<SpeechConfig>);Sourcepub fn set_thinking_config<T>(self, v: T) -> Selfwhere
T: Into<ThinkingConfig>,
pub fn set_thinking_config<T>(self, v: T) -> Selfwhere
T: Into<ThinkingConfig>,
Sets the value of thinking_config.
§Example
use google_cloud_aiplatform_v1::model::generation_config::ThinkingConfig;
let x = GenerationConfig::new().set_thinking_config(ThinkingConfig::default()/* use setters */);Sourcepub fn set_or_clear_thinking_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<ThinkingConfig>,
pub fn set_or_clear_thinking_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<ThinkingConfig>,
Sets or clears the value of thinking_config.
§Example
use google_cloud_aiplatform_v1::model::generation_config::ThinkingConfig;
let x = GenerationConfig::new().set_or_clear_thinking_config(Some(ThinkingConfig::default()/* use setters */));
let x = GenerationConfig::new().set_or_clear_thinking_config(None::<ThinkingConfig>);Sourcepub fn set_image_config<T>(self, v: T) -> Selfwhere
T: Into<ImageConfig>,
pub fn set_image_config<T>(self, v: T) -> Selfwhere
T: Into<ImageConfig>,
Sets the value of image_config.
§Example
use google_cloud_aiplatform_v1::model::ImageConfig;
let x = GenerationConfig::new().set_image_config(ImageConfig::default()/* use setters */);Sourcepub fn set_or_clear_image_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<ImageConfig>,
pub fn set_or_clear_image_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<ImageConfig>,
Sets or clears the value of image_config.
§Example
use google_cloud_aiplatform_v1::model::ImageConfig;
let x = GenerationConfig::new().set_or_clear_image_config(Some(ImageConfig::default()/* use setters */));
let x = GenerationConfig::new().set_or_clear_image_config(None::<ImageConfig>);Trait Implementations§
Source§impl Clone for GenerationConfig
impl Clone for GenerationConfig
Source§fn clone(&self) -> GenerationConfig
fn clone(&self) -> GenerationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more