Struct google_api_proto::google::cloud::dialogflow::v2::InferenceParameter
source · pub struct InferenceParameter {
pub max_output_tokens: Option<i32>,
pub temperature: Option<f64>,
pub top_k: Option<i32>,
pub top_p: Option<f64>,
}
Expand description
The parameters of inference.
Fields§
§max_output_tokens: Option<i32>
Optional. Maximum number of the output tokens for the generator.
temperature: Option<f64>
Optional. Controls the randomness of LLM predictions. Low temperature = less random. High temperature = more random. If unset (or 0), uses a default value of 0.
top_k: Option<i32>
Optional. Top-k changes how the model selects tokens for output. A top-k of 1 means the selected token is the most probable among all tokens in the model’s vocabulary (also called greedy decoding), while a top-k of 3 means that the next token is selected from among the 3 most probable tokens (using temperature). For each token selection step, the top K tokens with the highest probabilities are sampled. Then tokens are further filtered based on topP with the final token selected using temperature sampling. Specify a lower value for less random responses and a higher value for more random responses. Acceptable value is [1, 40], default to 40.
top_p: Option<f64>
Optional. Top-p changes how the model selects tokens for output. Tokens are selected from most K (see topK parameter) probable to least until the sum of their probabilities equals the top-p value. For example, if tokens A, B, and C have a probability of 0.3, 0.2, and 0.1 and the top-p value is 0.5, then the model will select either A or B as the next token (using temperature) and doesn’t consider C. The default top-p value is 0.95. Specify a lower value for less random responses and a higher value for more random responses. Acceptable value is [0.0, 1.0], default to 0.95.
Implementations§
source§impl InferenceParameter
impl InferenceParameter
sourcepub fn max_output_tokens(&self) -> i32
pub fn max_output_tokens(&self) -> i32
Returns the value of max_output_tokens
, or the default value if max_output_tokens
is unset.
sourcepub fn temperature(&self) -> f64
pub fn temperature(&self) -> f64
Returns the value of temperature
, or the default value if temperature
is unset.
Trait Implementations§
source§impl Clone for InferenceParameter
impl Clone for InferenceParameter
source§fn clone(&self) -> InferenceParameter
fn clone(&self) -> InferenceParameter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InferenceParameter
impl Debug for InferenceParameter
source§impl Default for InferenceParameter
impl Default for InferenceParameter
source§impl Message for InferenceParameter
impl Message for InferenceParameter
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for InferenceParameter
impl PartialEq for InferenceParameter
source§fn eq(&self, other: &InferenceParameter) -> bool
fn eq(&self, other: &InferenceParameter) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for InferenceParameter
impl StructuralPartialEq for InferenceParameter
Auto Trait Implementations§
impl Freeze for InferenceParameter
impl RefUnwindSafe for InferenceParameter
impl Send for InferenceParameter
impl Sync for InferenceParameter
impl Unpin for InferenceParameter
impl UnwindSafe for InferenceParameter
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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