Struct google_api_proto::google::ai::generativelanguage::v1beta::GenerateAnswerResponse
source · pub struct GenerateAnswerResponse {
pub answer: Option<Candidate>,
pub answerable_probability: Option<f32>,
pub input_feedback: Option<InputFeedback>,
}
Expand description
Response from the model for a grounded answer.
Fields§
§answer: Option<Candidate>
Candidate answer from the model.
Note: The model always attempts to provide a grounded answer, even when
the answer is unlikely to be answerable from the given passages.
In that case, a low-quality or ungrounded answer may be provided, along
with a low answerable_probability
.
answerable_probability: Option<f32>
Output only. The model’s estimate of the probability that its answer is correct and grounded in the input passages.
A low answerable_probability
indicates that the answer might not be
grounded in the sources.
When answerable_probability
is low, you may want to:
- Display a message to the effect of “We couldn’t answer that question” to the user.
- Fall back to a general-purpose LLM that answers the question from world
knowledge. The threshold and nature of such fallbacks will depend on
individual use cases.
0.5
is a good starting threshold.
input_feedback: Option<InputFeedback>
Output only. Feedback related to the input data used to answer the question, as opposed to the model-generated response to the question.
The input data can be one or more of the following:
- Question specified by the last entry in
GenerateAnswerRequest.content
- Conversation history specified by the other entries in
GenerateAnswerRequest.content
- Grounding sources (
GenerateAnswerRequest.semantic_retriever
orGenerateAnswerRequest.inline_passages
)
Implementations§
source§impl GenerateAnswerResponse
impl GenerateAnswerResponse
sourcepub fn answerable_probability(&self) -> f32
pub fn answerable_probability(&self) -> f32
Returns the value of answerable_probability
, or the default value if answerable_probability
is unset.
Trait Implementations§
source§impl Clone for GenerateAnswerResponse
impl Clone for GenerateAnswerResponse
source§fn clone(&self) -> GenerateAnswerResponse
fn clone(&self) -> GenerateAnswerResponse
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GenerateAnswerResponse
impl Debug for GenerateAnswerResponse
source§impl Default for GenerateAnswerResponse
impl Default for GenerateAnswerResponse
source§impl Message for GenerateAnswerResponse
impl Message for GenerateAnswerResponse
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 GenerateAnswerResponse
impl PartialEq for GenerateAnswerResponse
source§fn eq(&self, other: &GenerateAnswerResponse) -> bool
fn eq(&self, other: &GenerateAnswerResponse) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for GenerateAnswerResponse
Auto Trait Implementations§
impl Freeze for GenerateAnswerResponse
impl RefUnwindSafe for GenerateAnswerResponse
impl Send for GenerateAnswerResponse
impl Sync for GenerateAnswerResponse
impl Unpin for GenerateAnswerResponse
impl UnwindSafe for GenerateAnswerResponse
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