Answer

Struct Answer 

Source
#[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 */
}
Available on crate features conversational-search-service or session-service only.
Expand description

Defines an answer.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Immutable. Fully qualified name projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*

§state: State

The state of the answer generation.

§answer_text: String

The 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.

§related_questions: Vec<String>

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

Source

pub fn new() -> Self

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

§Example
let x = Answer::new().set_name("example");
Source

pub fn set_state<T: Into<State>>(self, v: T) -> Self

Sets the value of state.

§Example
use google_cloud_discoveryengine_v1::model::answer::State;
let x0 = Answer::new().set_state(State::InProgress);
let x1 = Answer::new().set_state(State::Failed);
let x2 = Answer::new().set_state(State::Succeeded);
Source

pub fn set_answer_text<T: Into<String>>(self, v: T) -> Self

Sets the value of answer_text.

§Example
let x = Answer::new().set_answer_text("example");
Source

pub fn set_grounding_score<T>(self, v: T) -> Self
where T: Into<f64>,

Sets the value of grounding_score.

§Example
let x = Answer::new().set_grounding_score(42.0);
Source

pub fn set_or_clear_grounding_score<T>(self, v: Option<T>) -> Self
where T: Into<f64>,

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>);
Source

pub fn set_citations<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Citation>,

Sets the value of citations.

§Example
use google_cloud_discoveryengine_v1::model::answer::Citation;
let x = Answer::new()
    .set_citations([
        Citation::default()/* use setters */,
        Citation::default()/* use (different) setters */,
    ]);
Source

pub fn set_grounding_supports<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<GroundingSupport>,

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 */,
    ]);
Source

pub fn set_references<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Reference>,

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"]);
Source

pub fn set_steps<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Step>,

Sets the value of steps.

§Example
use google_cloud_discoveryengine_v1::model::answer::Step;
let x = Answer::new()
    .set_steps([
        Step::default()/* use setters */,
        Step::default()/* use (different) setters */,
    ]);
Source

pub fn set_query_understanding_info<T>(self, v: T) -> Self

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 */);
Source

pub fn set_or_clear_query_understanding_info<T>(self, v: Option<T>) -> Self

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>);
Source

pub fn set_answer_skipped_reasons<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<AnswerSkippedReason>,

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,
]);
Source

pub fn set_create_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of create_time.

§Example
use wkt::Timestamp;
let x = Answer::new().set_create_time(Timestamp::default()/* use setters */);
Source

pub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

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>);
Source

pub fn set_complete_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of complete_time.

§Example
use wkt::Timestamp;
let x = Answer::new().set_complete_time(Timestamp::default()/* use setters */);
Source

pub fn set_or_clear_complete_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

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>);
Source

pub fn set_safety_ratings<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<SafetyRating>,

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 */,
    ]);

Trait Implementations§

Source§

impl Clone for Answer

Source§

fn clone(&self) -> Answer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Answer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Answer

Source§

fn default() -> Answer

Returns the “default value” for a type. Read more
Source§

impl Message for Answer

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Answer

Source§

fn eq(&self, other: &Answer) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Answer

Auto Trait Implementations§

§

impl Freeze for Answer

§

impl RefUnwindSafe for Answer

§

impl Send for Answer

§

impl Sync for Answer

§

impl Unpin for Answer

§

impl UnwindSafe for Answer

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,