#[non_exhaustive]pub struct Answer {Show 14 fields
pub name: String,
pub state: State,
pub answer_text: String,
pub grounding_score: Option<f64>,
pub citations: Vec<Citation>,
pub grounding_supports: Vec<GroundingSupport>,
pub references: Vec<Reference>,
pub related_questions: Vec<String>,
pub steps: Vec<Step>,
pub query_understanding_info: Option<QueryUnderstandingInfo>,
pub answer_skipped_reasons: Vec<AnswerSkippedReason>,
pub create_time: Option<Timestamp>,
pub complete_time: Option<Timestamp>,
pub safety_ratings: Vec<SafetyRating>,
/* private fields */
}conversational-search-service or session-service only.Expand description
Defines an answer.
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.name: StringImmutable. Fully qualified name
projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*
state: StateThe state of the answer generation.
answer_text: StringThe textual answer.
grounding_score: Option<f64>A score in the range of [0, 1] describing how grounded the answer is by the reference chunks.
citations: Vec<Citation>Citations.
grounding_supports: Vec<GroundingSupport>Optional. Grounding supports.
references: Vec<Reference>References.
Suggested related questions.
steps: Vec<Step>Answer generation steps.
query_understanding_info: Option<QueryUnderstandingInfo>Query understanding information.
answer_skipped_reasons: Vec<AnswerSkippedReason>Additional answer-skipped reasons. This provides the reason for ignored cases. If nothing is skipped, this field is not set.
create_time: Option<Timestamp>Output only. Answer creation timestamp.
complete_time: Option<Timestamp>Output only. Answer completed timestamp.
safety_ratings: Vec<SafetyRating>Optional. Safety ratings.
Implementations§
Source§impl Answer
impl Answer
pub fn new() -> Self
Sourcepub fn set_answer_text<T: Into<String>>(self, v: T) -> Self
pub fn set_answer_text<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_grounding_score<T>(self, v: T) -> Self
pub fn set_grounding_score<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_grounding_score<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_grounding_score<T>(self, v: Option<T>) -> Self
Sets or clears the value of grounding_score.
§Example
let x = Answer::new().set_or_clear_grounding_score(Some(42.0));
let x = Answer::new().set_or_clear_grounding_score(None::<f32>);Sourcepub fn set_citations<T, V>(self, v: T) -> Self
pub fn set_citations<T, V>(self, v: T) -> Self
Sourcepub fn set_grounding_supports<T, V>(self, v: T) -> Self
pub fn set_grounding_supports<T, V>(self, v: T) -> Self
Sets the value of grounding_supports.
§Example
use google_cloud_discoveryengine_v1::model::answer::GroundingSupport;
let x = Answer::new()
.set_grounding_supports([
GroundingSupport::default()/* use setters */,
GroundingSupport::default()/* use (different) setters */,
]);Sourcepub fn set_references<T, V>(self, v: T) -> Self
pub fn set_references<T, V>(self, v: T) -> Self
Sets the value of references.
§Example
use google_cloud_discoveryengine_v1::model::answer::Reference;
let x = Answer::new()
.set_references([
Reference::default()/* use setters */,
Reference::default()/* use (different) setters */,
]);Sets the value of related_questions.
§Example
let x = Answer::new().set_related_questions(["a", "b", "c"]);Sourcepub fn set_query_understanding_info<T>(self, v: T) -> Selfwhere
T: Into<QueryUnderstandingInfo>,
pub fn set_query_understanding_info<T>(self, v: T) -> Selfwhere
T: Into<QueryUnderstandingInfo>,
Sets the value of query_understanding_info.
§Example
use google_cloud_discoveryengine_v1::model::answer::QueryUnderstandingInfo;
let x = Answer::new().set_query_understanding_info(QueryUnderstandingInfo::default()/* use setters */);Sourcepub fn set_or_clear_query_understanding_info<T>(self, v: Option<T>) -> Selfwhere
T: Into<QueryUnderstandingInfo>,
pub fn set_or_clear_query_understanding_info<T>(self, v: Option<T>) -> Selfwhere
T: Into<QueryUnderstandingInfo>,
Sets or clears the value of query_understanding_info.
§Example
use google_cloud_discoveryengine_v1::model::answer::QueryUnderstandingInfo;
let x = Answer::new().set_or_clear_query_understanding_info(Some(QueryUnderstandingInfo::default()/* use setters */));
let x = Answer::new().set_or_clear_query_understanding_info(None::<QueryUnderstandingInfo>);Sourcepub fn set_answer_skipped_reasons<T, V>(self, v: T) -> Self
pub fn set_answer_skipped_reasons<T, V>(self, v: T) -> Self
Sets the value of answer_skipped_reasons.
§Example
use google_cloud_discoveryengine_v1::model::answer::AnswerSkippedReason;
let x = Answer::new().set_answer_skipped_reasons([
AnswerSkippedReason::AdversarialQueryIgnored,
AnswerSkippedReason::NonAnswerSeekingQueryIgnored,
AnswerSkippedReason::OutOfDomainQueryIgnored,
]);Sourcepub fn set_create_time<T>(self, v: T) -> Self
pub fn set_create_time<T>(self, v: T) -> Self
Sets the value of create_time.
§Example
use wkt::Timestamp;
let x = Answer::new().set_create_time(Timestamp::default()/* use setters */);Sourcepub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of create_time.
§Example
use wkt::Timestamp;
let x = Answer::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
let x = Answer::new().set_or_clear_create_time(None::<Timestamp>);Sourcepub fn set_complete_time<T>(self, v: T) -> Self
pub fn set_complete_time<T>(self, v: T) -> Self
Sets the value of complete_time.
§Example
use wkt::Timestamp;
let x = Answer::new().set_complete_time(Timestamp::default()/* use setters */);Sourcepub fn set_or_clear_complete_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_complete_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of complete_time.
§Example
use wkt::Timestamp;
let x = Answer::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
let x = Answer::new().set_or_clear_complete_time(None::<Timestamp>);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_discoveryengine_v1::model::SafetyRating;
let x = Answer::new()
.set_safety_ratings([
SafetyRating::default()/* use setters */,
SafetyRating::default()/* use (different) setters */,
]);