Struct google_api_proto::google::ai::generativelanguage::v1beta::GenerateMessageRequest
source · pub struct GenerateMessageRequest {
pub model: String,
pub prompt: Option<MessagePrompt>,
pub temperature: Option<f32>,
pub candidate_count: Option<i32>,
pub top_p: Option<f32>,
pub top_k: Option<i32>,
}
Expand description
Request to generate a message response from the model.
Fields§
§model: String
Required. The name of the model to use.
Format: name=models/{model}
.
prompt: Option<MessagePrompt>
Required. The structured textual input given to the model as a prompt.
Given a prompt, the model will return what it predicts is the next message in the discussion.
temperature: Option<f32>
Optional. Controls the randomness of the output.
Values can range over \[0.0,1.0\]
,
inclusive. A value closer to 1.0
will produce responses that are more
varied, while a value closer to 0.0
will typically result in
less surprising responses from the model.
candidate_count: Option<i32>
Optional. The number of generated response messages to return.
This value must be between
\[1, 8\]
, inclusive. If unset, this will default to 1
.
top_p: Option<f32>
Optional. The maximum cumulative probability of tokens to consider when sampling.
The model uses combined Top-k and nucleus sampling.
Nucleus sampling considers the smallest set of tokens whose probability
sum is at least top_p
.
top_k: Option<i32>
Optional. The maximum number of tokens to consider when sampling.
The model uses combined Top-k and nucleus sampling.
Top-k sampling considers the set of top_k
most probable tokens.
Implementations§
source§impl GenerateMessageRequest
impl GenerateMessageRequest
sourcepub fn temperature(&self) -> f32
pub fn temperature(&self) -> f32
Returns the value of temperature
, or the default value if temperature
is unset.
sourcepub fn candidate_count(&self) -> i32
pub fn candidate_count(&self) -> i32
Returns the value of candidate_count
, or the default value if candidate_count
is unset.
Trait Implementations§
source§impl Clone for GenerateMessageRequest
impl Clone for GenerateMessageRequest
source§fn clone(&self) -> GenerateMessageRequest
fn clone(&self) -> GenerateMessageRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GenerateMessageRequest
impl Debug for GenerateMessageRequest
source§impl Default for GenerateMessageRequest
impl Default for GenerateMessageRequest
source§impl Message for GenerateMessageRequest
impl Message for GenerateMessageRequest
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 GenerateMessageRequest
impl PartialEq for GenerateMessageRequest
source§fn eq(&self, other: &GenerateMessageRequest) -> bool
fn eq(&self, other: &GenerateMessageRequest) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for GenerateMessageRequest
Auto Trait Implementations§
impl Freeze for GenerateMessageRequest
impl RefUnwindSafe for GenerateMessageRequest
impl Send for GenerateMessageRequest
impl Sync for GenerateMessageRequest
impl Unpin for GenerateMessageRequest
impl UnwindSafe for GenerateMessageRequest
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