#[non_exhaustive]pub struct Candidate {
pub index: i32,
pub content: Option<Content>,
pub score: f64,
pub avg_logprobs: f64,
pub logprobs_result: Option<LogprobsResult>,
pub finish_reason: FinishReason,
pub safety_ratings: Vec<SafetyRating>,
pub finish_message: Option<String>,
pub citation_metadata: Option<CitationMetadata>,
pub grounding_metadata: Option<GroundingMetadata>,
pub url_context_metadata: Option<UrlContextMetadata>,
/* private fields */
}prediction-service only.Expand description
A response candidate generated from the model.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.index: i32Output only. Index of the candidate.
content: Option<Content>Output only. Content parts of the candidate.
score: f64Output only. Confidence score of the candidate.
avg_logprobs: f64Output only. Average log probability score of the candidate.
logprobs_result: Option<LogprobsResult>Output only. Log-likelihood scores for the response tokens and top tokens
finish_reason: FinishReasonOutput only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
safety_ratings: Vec<SafetyRating>Output only. List of ratings for the safety of a response candidate.
There is at most one rating per category.
finish_message: Option<String>Output only. Describes the reason the mode stopped generating tokens in
more detail. This is only filled when finish_reason is set.
citation_metadata: Option<CitationMetadata>Output only. Source attribution of the generated content.
grounding_metadata: Option<GroundingMetadata>Output only. Metadata specifies sources used to ground generated content.
url_context_metadata: Option<UrlContextMetadata>Output only. Metadata related to url context retrieval tool.
Implementations§
Source§impl Candidate
impl Candidate
pub fn new() -> Self
Sourcepub fn set_content<T>(self, v: T) -> Self
pub fn set_content<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_content<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_content<T>(self, v: Option<T>) -> Self
Sourcepub fn set_avg_logprobs<T: Into<f64>>(self, v: T) -> Self
pub fn set_avg_logprobs<T: Into<f64>>(self, v: T) -> Self
Sourcepub fn set_logprobs_result<T>(self, v: T) -> Selfwhere
T: Into<LogprobsResult>,
pub fn set_logprobs_result<T>(self, v: T) -> Selfwhere
T: Into<LogprobsResult>,
Sets the value of logprobs_result.
§Example
use google_cloud_aiplatform_v1::model::LogprobsResult;
let x = Candidate::new().set_logprobs_result(LogprobsResult::default()/* use setters */);Sourcepub fn set_or_clear_logprobs_result<T>(self, v: Option<T>) -> Selfwhere
T: Into<LogprobsResult>,
pub fn set_or_clear_logprobs_result<T>(self, v: Option<T>) -> Selfwhere
T: Into<LogprobsResult>,
Sets or clears the value of logprobs_result.
§Example
use google_cloud_aiplatform_v1::model::LogprobsResult;
let x = Candidate::new().set_or_clear_logprobs_result(Some(LogprobsResult::default()/* use setters */));
let x = Candidate::new().set_or_clear_logprobs_result(None::<LogprobsResult>);Sourcepub fn set_finish_reason<T: Into<FinishReason>>(self, v: T) -> Self
pub fn set_finish_reason<T: Into<FinishReason>>(self, v: T) -> Self
Sets the value of finish_reason.
§Example
use google_cloud_aiplatform_v1::model::candidate::FinishReason;
let x0 = Candidate::new().set_finish_reason(FinishReason::Stop);
let x1 = Candidate::new().set_finish_reason(FinishReason::MaxTokens);
let x2 = Candidate::new().set_finish_reason(FinishReason::Safety);Sourcepub fn set_safety_ratings<T, V>(self, v: T) -> Self
pub fn set_safety_ratings<T, V>(self, v: T) -> Self
Sets the value of safety_ratings.
§Example
use google_cloud_aiplatform_v1::model::SafetyRating;
let x = Candidate::new()
.set_safety_ratings([
SafetyRating::default()/* use setters */,
SafetyRating::default()/* use (different) setters */,
]);Sourcepub fn set_finish_message<T>(self, v: T) -> Self
pub fn set_finish_message<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_finish_message<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_finish_message<T>(self, v: Option<T>) -> Self
Sets or clears the value of finish_message.
§Example
let x = Candidate::new().set_or_clear_finish_message(Some("example"));
let x = Candidate::new().set_or_clear_finish_message(None::<String>);Sourcepub fn set_citation_metadata<T>(self, v: T) -> Selfwhere
T: Into<CitationMetadata>,
pub fn set_citation_metadata<T>(self, v: T) -> Selfwhere
T: Into<CitationMetadata>,
Sets the value of citation_metadata.
§Example
use google_cloud_aiplatform_v1::model::CitationMetadata;
let x = Candidate::new().set_citation_metadata(CitationMetadata::default()/* use setters */);Sourcepub fn set_or_clear_citation_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<CitationMetadata>,
pub fn set_or_clear_citation_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<CitationMetadata>,
Sets or clears the value of citation_metadata.
§Example
use google_cloud_aiplatform_v1::model::CitationMetadata;
let x = Candidate::new().set_or_clear_citation_metadata(Some(CitationMetadata::default()/* use setters */));
let x = Candidate::new().set_or_clear_citation_metadata(None::<CitationMetadata>);Sourcepub fn set_grounding_metadata<T>(self, v: T) -> Selfwhere
T: Into<GroundingMetadata>,
pub fn set_grounding_metadata<T>(self, v: T) -> Selfwhere
T: Into<GroundingMetadata>,
Sets the value of grounding_metadata.
§Example
use google_cloud_aiplatform_v1::model::GroundingMetadata;
let x = Candidate::new().set_grounding_metadata(GroundingMetadata::default()/* use setters */);Sourcepub fn set_or_clear_grounding_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<GroundingMetadata>,
pub fn set_or_clear_grounding_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<GroundingMetadata>,
Sets or clears the value of grounding_metadata.
§Example
use google_cloud_aiplatform_v1::model::GroundingMetadata;
let x = Candidate::new().set_or_clear_grounding_metadata(Some(GroundingMetadata::default()/* use setters */));
let x = Candidate::new().set_or_clear_grounding_metadata(None::<GroundingMetadata>);Sourcepub fn set_url_context_metadata<T>(self, v: T) -> Selfwhere
T: Into<UrlContextMetadata>,
pub fn set_url_context_metadata<T>(self, v: T) -> Selfwhere
T: Into<UrlContextMetadata>,
Sets the value of url_context_metadata.
§Example
use google_cloud_aiplatform_v1::model::UrlContextMetadata;
let x = Candidate::new().set_url_context_metadata(UrlContextMetadata::default()/* use setters */);Sourcepub fn set_or_clear_url_context_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<UrlContextMetadata>,
pub fn set_or_clear_url_context_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<UrlContextMetadata>,
Sets or clears the value of url_context_metadata.
§Example
use google_cloud_aiplatform_v1::model::UrlContextMetadata;
let x = Candidate::new().set_or_clear_url_context_metadata(Some(UrlContextMetadata::default()/* use setters */));
let x = Candidate::new().set_or_clear_url_context_metadata(None::<UrlContextMetadata>);