Skip to main content

ServingConfig

Struct ServingConfig 

Source
#[non_exhaustive]
pub struct ServingConfig {
Show 20 fields pub name: String, pub display_name: String, pub model_id: String, pub price_reranking_level: String, pub facet_control_ids: Vec<String>, pub dynamic_facet_spec: Option<DynamicFacetSpec>, pub boost_control_ids: Vec<String>, pub filter_control_ids: Vec<String>, pub redirect_control_ids: Vec<String>, pub twoway_synonyms_control_ids: Vec<String>, pub oneway_synonyms_control_ids: Vec<String>, pub do_not_associate_control_ids: Vec<String>, pub replacement_control_ids: Vec<String>, pub ignore_control_ids: Vec<String>, pub diversity_level: String, pub diversity_type: DiversityType, pub enable_category_filter_level: String, pub ignore_recs_denylist: bool, pub personalization_spec: Option<PersonalizationSpec>, pub solution_types: Vec<SolutionType>, /* private fields */
}
Expand description

Configures metadata that is used to generate serving time results (e.g. search results or recommendation predictions).

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/*/locations/global/catalogs/*/servingConfig/*

§display_name: String

Required. The human readable serving config display name. Used in Retail UI.

This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

§model_id: String

The id of the model in the same Catalog to use at serving time. Currently only RecommendationModels are supported: https://cloud.google.com/retail/recommendations-ai/docs/create-models Can be changed but only to a compatible model (e.g. others-you-may-like CTR to others-you-may-like CVR).

Required when solution_types is SOLUTION_TYPE_RECOMMENDATION.

§price_reranking_level: String

How much price ranking we want in serving results. Price reranking causes product items with a similar recommendation probability to be ordered by price, with the highest-priced items first. This setting could result in a decrease in click-through and conversion rates. Allowed values are:

  • no-price-reranking
  • low-price-reranking
  • medium-price-reranking
  • high-price-reranking

If not specified, we choose default based on model type. Default value: no-price-reranking.

Can only be set if solution_types is SOLUTION_TYPE_RECOMMENDATION.

§facet_control_ids: Vec<String>

Facet specifications for faceted search. If empty, no facets are returned. The ids refer to the ids of Control resources with only the Facet control set. These controls are assumed to be in the same Catalog as the ServingConfig. A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error is returned.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§dynamic_facet_spec: Option<DynamicFacetSpec>

The specification for dynamically generated facets. Notice that only textual facets can be dynamically generated.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§boost_control_ids: Vec<String>

Condition boost specifications. If a product matches multiple conditions in the specifications, boost scores from these specifications are all applied and combined in a non-linear way. Maximum number of specifications is 100.

Notice that if both ServingConfig.boost_control_ids and SearchRequest.boost_spec are set, the boost conditions from both places are evaluated. If a search request matches multiple boost conditions, the final boost score is equal to the sum of the boost scores from all matched boost conditions.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§filter_control_ids: Vec<String>

Condition filter specifications. If a product matches multiple conditions in the specifications, filters from these specifications are all applied and combined via the AND operator. Maximum number of specifications is 100.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§redirect_control_ids: Vec<String>

Condition redirect specifications. Only the first triggered redirect action is applied, even if multiple apply. Maximum number of specifications is 1000.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§twoway_synonyms_control_ids: Vec<String>

Condition synonyms specifications. If multiple syonyms conditions match, all matching synonyms control in the list will execute. Order of controls in the list will not matter. Maximum number of specifications is 100.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§oneway_synonyms_control_ids: Vec<String>

Condition oneway synonyms specifications. If multiple oneway synonyms conditions match, all matching oneway synonyms controls in the list will execute. Order of controls in the list will not matter. Maximum number of specifications is 100.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§do_not_associate_control_ids: Vec<String>

Condition do not associate specifications. If multiple do not associate conditions match, all matching do not associate controls in the list will execute.

  • Order does not matter.
  • Maximum number of specifications is 100.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§replacement_control_ids: Vec<String>

Condition replacement specifications.

  • Applied according to the order in the list.
  • A previously replaced term can not be re-replaced.
  • Maximum number of specifications is 100.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§ignore_control_ids: Vec<String>

Condition ignore specifications. If multiple ignore conditions match, all matching ignore controls in the list will execute.

  • Order does not matter.
  • Maximum number of specifications is 100.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

§diversity_level: String

How much diversity to use in recommendation model results e.g. medium-diversity or high-diversity. Currently supported values:

  • no-diversity
  • low-diversity
  • medium-diversity
  • high-diversity
  • auto-diversity

If not specified, we choose default based on recommendation model type. Default value: no-diversity.

Can only be set if solution_types is SOLUTION_TYPE_RECOMMENDATION.

§diversity_type: DiversityType

What kind of diversity to use - data driven or rule based. If unset, the server behavior defaults to RULE_BASED_DIVERSITY.

§enable_category_filter_level: String

Whether to add additional category filters on the similar-items model. If not specified, we enable it by default. Allowed values are:

  • no-category-match: No additional filtering of original results from the model and the customer’s filters.
  • relaxed-category-match: Only keep results with categories that match at least one item categories in the PredictRequests’s context item.
    • If customer also sends filters in the PredictRequest, then the results will satisfy both conditions (user given and category match).

Can only be set if solution_types is SOLUTION_TYPE_RECOMMENDATION.

§ignore_recs_denylist: bool

When the flag is enabled, the products in the denylist will not be filtered out in the recommendation filtering results.

§personalization_spec: Option<PersonalizationSpec>

The specification for personalization spec.

Can only be set if solution_types is SOLUTION_TYPE_SEARCH.

Notice that if both ServingConfig.personalization_spec and SearchRequest.personalization_spec are set. SearchRequest.personalization_spec will override ServingConfig.personalization_spec.

§solution_types: Vec<SolutionType>

Required. Immutable. Specifies the solution types that a serving config can be associated with. Currently we support setting only one type of solution.

Implementations§

Source§

impl ServingConfig

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 = ServingConfig::new().set_name("example");
Source

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

Sets the value of display_name.

§Example
let x = ServingConfig::new().set_display_name("example");
Source

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

Sets the value of model_id.

§Example
let x = ServingConfig::new().set_model_id("example");
Source

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

Sets the value of price_reranking_level.

§Example
let x = ServingConfig::new().set_price_reranking_level("example");
Source

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

Sets the value of facet_control_ids.

§Example
let x = ServingConfig::new().set_facet_control_ids(["a", "b", "c"]);
Source

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

Sets the value of dynamic_facet_spec.

§Example
use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
let x = ServingConfig::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
Source

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

Sets or clears the value of dynamic_facet_spec.

§Example
use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
Source

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

Sets the value of boost_control_ids.

§Example
let x = ServingConfig::new().set_boost_control_ids(["a", "b", "c"]);
Source

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

Sets the value of filter_control_ids.

§Example
let x = ServingConfig::new().set_filter_control_ids(["a", "b", "c"]);
Source

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

Sets the value of redirect_control_ids.

§Example
let x = ServingConfig::new().set_redirect_control_ids(["a", "b", "c"]);
Source

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

Sets the value of twoway_synonyms_control_ids.

§Example
let x = ServingConfig::new().set_twoway_synonyms_control_ids(["a", "b", "c"]);
Source

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

Sets the value of oneway_synonyms_control_ids.

§Example
let x = ServingConfig::new().set_oneway_synonyms_control_ids(["a", "b", "c"]);
Source

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

Sets the value of do_not_associate_control_ids.

§Example
let x = ServingConfig::new().set_do_not_associate_control_ids(["a", "b", "c"]);
Source

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

Sets the value of replacement_control_ids.

§Example
let x = ServingConfig::new().set_replacement_control_ids(["a", "b", "c"]);
Source

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

Sets the value of ignore_control_ids.

§Example
let x = ServingConfig::new().set_ignore_control_ids(["a", "b", "c"]);
Source

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

Sets the value of diversity_level.

§Example
let x = ServingConfig::new().set_diversity_level("example");
Source

pub fn set_diversity_type<T: Into<DiversityType>>(self, v: T) -> Self

Sets the value of diversity_type.

§Example
use google_cloud_retail_v2::model::serving_config::DiversityType;
let x0 = ServingConfig::new().set_diversity_type(DiversityType::RuleBasedDiversity);
let x1 = ServingConfig::new().set_diversity_type(DiversityType::DataDrivenDiversity);
Source

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

Sets the value of enable_category_filter_level.

§Example
let x = ServingConfig::new().set_enable_category_filter_level("example");
Source

pub fn set_ignore_recs_denylist<T: Into<bool>>(self, v: T) -> Self

Sets the value of ignore_recs_denylist.

§Example
let x = ServingConfig::new().set_ignore_recs_denylist(true);
Source

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

Sets the value of personalization_spec.

§Example
use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
let x = ServingConfig::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
Source

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

Sets or clears the value of personalization_spec.

§Example
use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
let x = ServingConfig::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
let x = ServingConfig::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
Source

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

Sets the value of solution_types.

§Example
use google_cloud_retail_v2::model::SolutionType;
let x = ServingConfig::new().set_solution_types([
    SolutionType::Recommendation,
    SolutionType::Search,
]);

Trait Implementations§

Source§

impl Clone for ServingConfig

Source§

fn clone(&self) -> ServingConfig

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 ServingConfig

Source§

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

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

impl Default for ServingConfig

Source§

fn default() -> ServingConfig

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

impl Message for ServingConfig

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for ServingConfig

Source§

fn eq(&self, other: &ServingConfig) -> 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 ServingConfig

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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<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>,