#[non_exhaustive]pub struct GenerationConfig {Show 21 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 audio_timestamp: Option<bool>,
pub response_modalities: Vec<Modality>,
pub media_resolution: Option<MediaResolution>,
pub speech_config: Option<SpeechConfig>,
pub thinking_config: Option<ThinkingConfig>,
pub image_config: Option<ImageConfig>,
/* private fields */
}gen-ai-tuning-service or 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.
audio_timestamp: Option<bool>Optional. If enabled, audio timestamps will be included in the request to the model. This can be useful for synchronizing audio with other modalities in the response.
response_modalities: Vec<Modality>Optional. The modalities of the response. The model will generate a
response that includes all the specified modalities. For example, if this
is set to [TEXT, IMAGE], the response will include both text and an
image.
media_resolution: Option<MediaResolution>Optional. The token resolution at which input media content is sampled. This is used to control the trade-off between the quality of the response and the number of tokens used to represent the media. A higher resolution allows the model to perceive more detail, which can lead to a more nuanced response, but it will also use more tokens. This does not affect the image dimensions sent to the model.
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
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_audio_timestamp<T>(self, v: T) -> Self
pub fn set_audio_timestamp<T>(self, v: T) -> Self
Sets the value of audio_timestamp.
§Example
let x = GenerationConfig::new().set_audio_timestamp(true);Sourcepub fn set_or_clear_audio_timestamp<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_audio_timestamp<T>(self, v: Option<T>) -> Self
Sets or clears the value of audio_timestamp.
§Example
let x = GenerationConfig::new().set_or_clear_audio_timestamp(Some(false));
let x = GenerationConfig::new().set_or_clear_audio_timestamp(None::<bool>);Sourcepub fn set_response_modalities<T, V>(self, v: T) -> Self
pub fn set_response_modalities<T, V>(self, v: T) -> Self
Sets the value of response_modalities.
§Example
use google_cloud_aiplatform_v1::model::generation_config::Modality;
let x = GenerationConfig::new().set_response_modalities([
Modality::Text,
Modality::Image,
Modality::Audio,
]);Sourcepub fn set_media_resolution<T>(self, v: T) -> Selfwhere
T: Into<MediaResolution>,
pub fn set_media_resolution<T>(self, v: T) -> Selfwhere
T: Into<MediaResolution>,
Sets the value of media_resolution.
§Example
use google_cloud_aiplatform_v1::model::generation_config::MediaResolution;
let x0 = GenerationConfig::new().set_media_resolution(MediaResolution::Low);
let x1 = GenerationConfig::new().set_media_resolution(MediaResolution::Medium);
let x2 = GenerationConfig::new().set_media_resolution(MediaResolution::High);Sourcepub fn set_or_clear_media_resolution<T>(self, v: Option<T>) -> Selfwhere
T: Into<MediaResolution>,
pub fn set_or_clear_media_resolution<T>(self, v: Option<T>) -> Selfwhere
T: Into<MediaResolution>,
Sets or clears the value of media_resolution.
§Example
use google_cloud_aiplatform_v1::model::generation_config::MediaResolution;
let x0 = GenerationConfig::new().set_or_clear_media_resolution(Some(MediaResolution::Low));
let x1 = GenerationConfig::new().set_or_clear_media_resolution(Some(MediaResolution::Medium));
let x2 = GenerationConfig::new().set_or_clear_media_resolution(Some(MediaResolution::High));
let x_none = GenerationConfig::new().set_or_clear_media_resolution(None::<MediaResolution>);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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GenerationConfig
impl Debug for GenerationConfig
Source§impl Default for GenerationConfig
impl Default for GenerationConfig
Source§fn default() -> GenerationConfig
fn default() -> GenerationConfig
Source§impl Message for GenerationConfig
impl Message for GenerationConfig
Source§impl PartialEq for GenerationConfig
impl PartialEq for GenerationConfig
impl StructuralPartialEq for GenerationConfig
Auto Trait Implementations§
impl Freeze for GenerationConfig
impl RefUnwindSafe for GenerationConfig
impl Send for GenerationConfig
impl Sync for GenerationConfig
impl Unpin for GenerationConfig
impl UnsafeUnpin for GenerationConfig
impl UnwindSafe for GenerationConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request