#[non_exhaustive]pub struct AnswerGenerationSpec {
pub model_spec: Option<ModelSpec>,
pub prompt_spec: Option<PromptSpec>,
pub include_citations: bool,
pub answer_language_code: String,
pub ignore_adversarial_query: bool,
pub ignore_non_answer_seeking_query: bool,
pub ignore_low_relevant_content: Option<bool>,
pub ignore_jail_breaking_query: bool,
/* private fields */
}conversational-search-service only.Expand description
Answer generation specification.
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.model_spec: Option<ModelSpec>Answer generation model specification.
prompt_spec: Option<PromptSpec>Answer generation prompt specification.
include_citations: boolSpecifies whether to include citation metadata in the answer. The default
value is false.
answer_language_code: StringLanguage code for Answer. Use language tags defined by BCP47. Note: This is an experimental feature.
ignore_adversarial_query: boolSpecifies whether to filter out adversarial queries. The default value
is false.
Google employs search-query classification to detect adversarial
queries. No answer is returned if the search query is classified as an
adversarial query. For example, a user might ask a question regarding
negative comments about the company or submit a query designed to
generate unsafe, policy-violating output. If this field is set to
true, we skip generating answers for adversarial queries and return
fallback messages instead.
ignore_non_answer_seeking_query: boolSpecifies whether to filter out queries that are not answer-seeking.
The default value is false.
Google employs search-query classification to detect answer-seeking
queries. No answer is returned if the search query is classified as a
non-answer seeking query. If this field is set to true, we skip
generating answers for non-answer seeking queries and return
fallback messages instead.
ignore_low_relevant_content: Option<bool>Specifies whether to filter out queries that have low relevance.
If this field is set to false, all search results are used regardless
of relevance to generate answers. If set to true or unset, the behavior
will be determined automatically by the service.
ignore_jail_breaking_query: boolOptional. Specifies whether to filter out jail-breaking queries. The
default value is false.
Google employs search-query classification to detect jail-breaking
queries. No summary is returned if the search query is classified as a
jail-breaking query. A user might add instructions to the query to
change the tone, style, language, content of the answer, or ask the
model to act as a different entity, e.g. “Reply in the tone of a
competing company’s CEO”. If this field is set to true, we skip
generating summaries for jail-breaking queries and return fallback
messages instead.
Implementations§
Source§impl AnswerGenerationSpec
impl AnswerGenerationSpec
pub fn new() -> Self
Sourcepub fn set_model_spec<T>(self, v: T) -> Self
pub fn set_model_spec<T>(self, v: T) -> Self
Sets the value of model_spec.
§Example
use google_cloud_discoveryengine_v1::model::answer_query_request::answer_generation_spec::ModelSpec;
let x = AnswerGenerationSpec::new().set_model_spec(ModelSpec::default()/* use setters */);Sourcepub fn set_or_clear_model_spec<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_model_spec<T>(self, v: Option<T>) -> Self
Sets or clears the value of model_spec.
§Example
use google_cloud_discoveryengine_v1::model::answer_query_request::answer_generation_spec::ModelSpec;
let x = AnswerGenerationSpec::new().set_or_clear_model_spec(Some(ModelSpec::default()/* use setters */));
let x = AnswerGenerationSpec::new().set_or_clear_model_spec(None::<ModelSpec>);Sourcepub fn set_prompt_spec<T>(self, v: T) -> Selfwhere
T: Into<PromptSpec>,
pub fn set_prompt_spec<T>(self, v: T) -> Selfwhere
T: Into<PromptSpec>,
Sets the value of prompt_spec.
§Example
use google_cloud_discoveryengine_v1::model::answer_query_request::answer_generation_spec::PromptSpec;
let x = AnswerGenerationSpec::new().set_prompt_spec(PromptSpec::default()/* use setters */);Sourcepub fn set_or_clear_prompt_spec<T>(self, v: Option<T>) -> Selfwhere
T: Into<PromptSpec>,
pub fn set_or_clear_prompt_spec<T>(self, v: Option<T>) -> Selfwhere
T: Into<PromptSpec>,
Sets or clears the value of prompt_spec.
§Example
use google_cloud_discoveryengine_v1::model::answer_query_request::answer_generation_spec::PromptSpec;
let x = AnswerGenerationSpec::new().set_or_clear_prompt_spec(Some(PromptSpec::default()/* use setters */));
let x = AnswerGenerationSpec::new().set_or_clear_prompt_spec(None::<PromptSpec>);Sourcepub fn set_include_citations<T: Into<bool>>(self, v: T) -> Self
pub fn set_include_citations<T: Into<bool>>(self, v: T) -> Self
Sets the value of include_citations.
§Example
let x = AnswerGenerationSpec::new().set_include_citations(true);Sourcepub fn set_answer_language_code<T: Into<String>>(self, v: T) -> Self
pub fn set_answer_language_code<T: Into<String>>(self, v: T) -> Self
Sets the value of answer_language_code.
§Example
let x = AnswerGenerationSpec::new().set_answer_language_code("example");Sourcepub fn set_ignore_adversarial_query<T: Into<bool>>(self, v: T) -> Self
pub fn set_ignore_adversarial_query<T: Into<bool>>(self, v: T) -> Self
Sets the value of ignore_adversarial_query.
§Example
let x = AnswerGenerationSpec::new().set_ignore_adversarial_query(true);Sourcepub fn set_ignore_non_answer_seeking_query<T: Into<bool>>(self, v: T) -> Self
pub fn set_ignore_non_answer_seeking_query<T: Into<bool>>(self, v: T) -> Self
Sets the value of ignore_non_answer_seeking_query.
§Example
let x = AnswerGenerationSpec::new().set_ignore_non_answer_seeking_query(true);Sourcepub fn set_ignore_low_relevant_content<T>(self, v: T) -> Self
pub fn set_ignore_low_relevant_content<T>(self, v: T) -> Self
Sets the value of ignore_low_relevant_content.
§Example
let x = AnswerGenerationSpec::new().set_ignore_low_relevant_content(true);Sourcepub fn set_or_clear_ignore_low_relevant_content<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_ignore_low_relevant_content<T>(self, v: Option<T>) -> Self
Sets or clears the value of ignore_low_relevant_content.
§Example
let x = AnswerGenerationSpec::new().set_or_clear_ignore_low_relevant_content(Some(false));
let x = AnswerGenerationSpec::new().set_or_clear_ignore_low_relevant_content(None::<bool>);Sourcepub fn set_ignore_jail_breaking_query<T: Into<bool>>(self, v: T) -> Self
pub fn set_ignore_jail_breaking_query<T: Into<bool>>(self, v: T) -> Self
Sets the value of ignore_jail_breaking_query.
§Example
let x = AnswerGenerationSpec::new().set_ignore_jail_breaking_query(true);Trait Implementations§
Source§impl Clone for AnswerGenerationSpec
impl Clone for AnswerGenerationSpec
Source§fn clone(&self) -> AnswerGenerationSpec
fn clone(&self) -> AnswerGenerationSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more