#[non_exhaustive]pub struct GenerationSpec {
pub model_id: String,
pub language_code: String,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<i32>,
pub frequency_penalty: Option<f32>,
pub seed: Option<i32>,
pub presence_penalty: Option<f32>,
pub max_output_tokens: Option<i32>,
/* private fields */
}grounded-generation-service only.Expand description
Content generation specification.
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.model_id: StringSpecifies which Vertex model id to use for generation.
language_code: StringLanguage code for content. Use language tags defined by BCP47.
temperature: Option<f32>If specified, custom value for the temperature will be used.
top_p: Option<f32>If specified, custom value for nucleus sampling will be used.
top_k: Option<i32>If specified, custom value for top-k sampling will be used.
frequency_penalty: Option<f32>If specified, custom value for frequency penalty will be used.
seed: Option<i32>If specified, custom value for the seed will be used.
presence_penalty: Option<f32>If specified, custom value for presence penalty will be used.
max_output_tokens: Option<i32>If specified, custom value for max output tokens will be used.
Implementations§
Source§impl GenerationSpec
impl GenerationSpec
pub fn new() -> Self
Sourcepub fn set_model_id<T: Into<String>>(self, v: T) -> Self
pub fn set_model_id<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_language_code<T: Into<String>>(self, v: T) -> Self
pub fn set_language_code<T: Into<String>>(self, v: T) -> Self
Sets the value of language_code.
§Example
let x = GenerationSpec::new().set_language_code("example");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 = GenerationSpec::new().set_or_clear_temperature(Some(42.0));
let x = GenerationSpec::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_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 = GenerationSpec::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 = GenerationSpec::new().set_or_clear_frequency_penalty(Some(42.0));
let x = GenerationSpec::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_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 = GenerationSpec::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 = GenerationSpec::new().set_or_clear_presence_penalty(Some(42.0));
let x = GenerationSpec::new().set_or_clear_presence_penalty(None::<f32>);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 = GenerationSpec::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 = GenerationSpec::new().set_or_clear_max_output_tokens(Some(42));
let x = GenerationSpec::new().set_or_clear_max_output_tokens(None::<i32>);Trait Implementations§
Source§impl Clone for GenerationSpec
impl Clone for GenerationSpec
Source§fn clone(&self) -> GenerationSpec
fn clone(&self) -> GenerationSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more