#[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
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GenerationSpec
impl Debug for GenerationSpec
Source§impl Default for GenerationSpec
impl Default for GenerationSpec
Source§fn default() -> GenerationSpec
fn default() -> GenerationSpec
Source§impl Message for GenerationSpec
impl Message for GenerationSpec
Source§impl PartialEq for GenerationSpec
impl PartialEq for GenerationSpec
impl StructuralPartialEq for GenerationSpec
Auto Trait Implementations§
impl Freeze for GenerationSpec
impl RefUnwindSafe for GenerationSpec
impl Send for GenerationSpec
impl Sync for GenerationSpec
impl Unpin for GenerationSpec
impl UnsafeUnpin for GenerationSpec
impl UnwindSafe for GenerationSpec
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