Struct google_api_proto::google::ai::generativelanguage::v1::Candidate
source · pub struct Candidate {
pub index: Option<i32>,
pub content: Option<Content>,
pub finish_reason: i32,
pub safety_ratings: Vec<SafetyRating>,
pub citation_metadata: Option<CitationMetadata>,
pub token_count: i32,
}
Expand description
A response candidate generated from the model.
Fields§
§index: Option<i32>
Output only. Index of the candidate in the list of response candidates.
content: Option<Content>
Output only. Generated content returned from the model.
finish_reason: i32
Optional. Output only. The reason why the model stopped generating tokens.
If empty, the model has not stopped generating tokens.
safety_ratings: Vec<SafetyRating>
List of ratings for the safety of a response candidate.
There is at most one rating per category.
citation_metadata: Option<CitationMetadata>
Output only. Citation information for model-generated candidate.
This field may be populated with recitation information for any text
included in the content
. These are passages that are “recited” from
copyrighted material in the foundational LLM’s training data.
token_count: i32
Output only. Token count for this candidate.
Implementations§
source§impl Candidate
impl Candidate
sourcepub fn finish_reason(&self) -> FinishReason
pub fn finish_reason(&self) -> FinishReason
Returns the enum value of finish_reason
, or the default if the field is set to an invalid enum value.
sourcepub fn set_finish_reason(&mut self, value: FinishReason)
pub fn set_finish_reason(&mut self, value: FinishReason)
Sets finish_reason
to the provided enum value.
Trait Implementations§
source§impl Message for Candidate
impl Message for Candidate
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 Candidate
impl PartialEq for Candidate
impl StructuralPartialEq for Candidate
Auto Trait Implementations§
impl Freeze for Candidate
impl RefUnwindSafe for Candidate
impl Send for Candidate
impl Sync for Candidate
impl Unpin for Candidate
impl UnwindSafe for Candidate
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