Struct google_api_proto::google::ai::generativelanguage::v1beta::GenerateAnswerRequest
source · pub struct GenerateAnswerRequest {
pub model: String,
pub contents: Vec<Content>,
pub answer_style: i32,
pub safety_settings: Vec<SafetySetting>,
pub temperature: Option<f32>,
pub grounding_source: Option<GroundingSource>,
}
Expand description
Request to generate a grounded answer from the Model
.
Fields§
§model: String
Required. The name of the Model
to use for generating the grounded
response.
Format: model=models/{model}
.
contents: Vec<Content>
Required. The content of the current conversation with the Model
. For
single-turn queries, this is a single question to answer. For multi-turn
queries, this is a repeated field that contains conversation history and
the last Content
in the list containing the question.
Note: GenerateAnswer
only supports queries in English.
answer_style: i32
Required. Style in which answers should be returned.
safety_settings: Vec<SafetySetting>
Optional. A list of unique SafetySetting
instances for blocking unsafe
content.
This will be enforced on the GenerateAnswerRequest.contents
and
GenerateAnswerResponse.candidate
. There should not be more than one
setting for each SafetyCategory
type. The API will block any contents and
responses that fail to meet the thresholds set by these settings. This list
overrides the default settings for each SafetyCategory
specified in the
safety_settings. If there is no SafetySetting
for a given
SafetyCategory
provided in the list, the API will use the default safety
setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH,
HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT,
HARM_CATEGORY_HARASSMENT are supported.
Refer to the
guide
for detailed information on available safety settings. Also refer to the
Safety guidance to
learn how to incorporate safety considerations in your AI applications.
temperature: Option<f32>
Optional. Controls the randomness of the output.
Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. A low temperature (~0.2) is usually recommended for Attributed-Question-Answering use cases.
grounding_source: Option<GroundingSource>
The sources in which to ground the answer.
Implementations§
source§impl GenerateAnswerRequest
impl GenerateAnswerRequest
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 answer_style(&self) -> AnswerStyle
pub fn answer_style(&self) -> AnswerStyle
Returns the enum value of answer_style
, or the default if the field is set to an invalid enum value.
sourcepub fn set_answer_style(&mut self, value: AnswerStyle)
pub fn set_answer_style(&mut self, value: AnswerStyle)
Sets answer_style
to the provided enum value.
Trait Implementations§
source§impl Clone for GenerateAnswerRequest
impl Clone for GenerateAnswerRequest
source§fn clone(&self) -> GenerateAnswerRequest
fn clone(&self) -> GenerateAnswerRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GenerateAnswerRequest
impl Debug for GenerateAnswerRequest
source§impl Default for GenerateAnswerRequest
impl Default for GenerateAnswerRequest
source§impl Message for GenerateAnswerRequest
impl Message for GenerateAnswerRequest
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 GenerateAnswerRequest
impl PartialEq for GenerateAnswerRequest
source§fn eq(&self, other: &GenerateAnswerRequest) -> bool
fn eq(&self, other: &GenerateAnswerRequest) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for GenerateAnswerRequest
Auto Trait Implementations§
impl Freeze for GenerateAnswerRequest
impl RefUnwindSafe for GenerateAnswerRequest
impl Send for GenerateAnswerRequest
impl Sync for GenerateAnswerRequest
impl Unpin for GenerateAnswerRequest
impl UnwindSafe for GenerateAnswerRequest
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