ServingConfig

Struct ServingConfig 

Source
#[non_exhaustive]
pub struct ServingConfig {
Show 18 fields pub name: String, pub display_name: String, pub solution_type: SolutionType, pub model_id: String, pub diversity_level: String, pub ranking_expression: String, pub create_time: Option<Timestamp>, pub update_time: Option<Timestamp>, pub filter_control_ids: Vec<String>, pub boost_control_ids: Vec<String>, pub redirect_control_ids: Vec<String>, pub synonyms_control_ids: Vec<String>, pub oneway_synonyms_control_ids: Vec<String>, pub dissociate_control_ids: Vec<String>, pub replacement_control_ids: Vec<String>, pub ignore_control_ids: Vec<String>, pub promote_control_ids: Vec<String>, pub vertical_config: Option<VerticalConfig>, /* private fields */
}
Available on crate feature serving-config-service only.
Expand description

Configures metadata that is used to generate serving time results (e.g. search results or recommendation predictions). The ServingConfig is passed in the search and predict request and generates results.

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/{location}/collections/{collection_id}/engines/{engine_id}/servingConfigs/{serving_config_id}

§display_name: String

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

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

§solution_type: SolutionType

Required. Immutable. Specifies the solution type that a serving config can be associated with.

§model_id: String

The id of the model to use at serving time. Currently only RecommendationModels are supported. Can be changed but only to a compatible model (e.g. others-you-may-like CTR to others-you-may-like CVR).

Required when SolutionType is SOLUTION_TYPE_RECOMMENDATION.

§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 SolutionType is SOLUTION_TYPE_RECOMMENDATION.

§ranking_expression: String

The ranking expression controls the customized ranking on retrieval documents. To leverage this, document embedding is required. The ranking expression setting in ServingConfig applies to all search requests served by the serving config. However, if SearchRequest.ranking_expression is specified, it overrides the ServingConfig ranking expression.

The ranking expression is a single function or multiple functions that are joined by “+”.

  • ranking_expression = function, { “ + “, function };

Supported functions:

  • double * relevance_score
  • double * dotProduct(embedding_field_path)

Function variables:

  • relevance_score: pre-defined keywords, used for measure relevance between query and document.
  • embedding_field_path: the document embedding field used with query embedding vector.
  • dotProduct: embedding function between embedding_field_path and query embedding vector.

Example ranking expression:

If document has an embedding field doc_embedding, the ranking expression could be 0.5 * relevance_score + 0.3 * dotProduct(doc_embedding).

§create_time: Option<Timestamp>

Output only. ServingConfig created timestamp.

§update_time: Option<Timestamp>

Output only. ServingConfig updated timestamp.

§filter_control_ids: Vec<String>

Filter controls to use in serving path. All triggered filter controls will be applied. Filter controls must be in the same data store as the serving config. Maximum of 20 filter controls.

§boost_control_ids: Vec<String>

Boost controls to use in serving path. All triggered boost controls will be applied. Boost controls must be in the same data store as the serving config. Maximum of 20 boost controls.

§redirect_control_ids: Vec<String>

IDs of the redirect controls. Only the first triggered redirect action is applied, even if multiple apply. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

§synonyms_control_ids: Vec<String>

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

Can only be set if SolutionType 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. Maximum number of specifications is 100.

Can only be set if SolutionType is SOLUTION_TYPE_SEARCH.

§dissociate_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 SolutionType 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 SolutionType 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.

§promote_control_ids: Vec<String>

Condition promote specifications.

Maximum number of specifications is 100.

§vertical_config: Option<VerticalConfig>

Industry vertical specific config.

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_solution_type<T: Into<SolutionType>>(self, v: T) -> Self

Sets the value of solution_type.

§Example
use google_cloud_discoveryengine_v1::model::SolutionType;
let x0 = ServingConfig::new().set_solution_type(SolutionType::Recommendation);
let x1 = ServingConfig::new().set_solution_type(SolutionType::Search);
let x2 = ServingConfig::new().set_solution_type(SolutionType::Chat);
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_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_ranking_expression<T: Into<String>>(self, v: T) -> Self

Sets the value of ranking_expression.

§Example
let x = ServingConfig::new().set_ranking_expression("example");
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 = ServingConfig::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 = ServingConfig::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
let x = ServingConfig::new().set_or_clear_create_time(None::<Timestamp>);
Source

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

Sets the value of update_time.

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

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

Sets or clears the value of update_time.

§Example
use wkt::Timestamp;
let x = ServingConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
let x = ServingConfig::new().set_or_clear_update_time(None::<Timestamp>);
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_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_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_synonyms_control_ids<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of synonyms_control_ids.

§Example
let x = ServingConfig::new().set_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_dissociate_control_ids<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of dissociate_control_ids.

§Example
let x = ServingConfig::new().set_dissociate_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_promote_control_ids<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of promote_control_ids.

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

pub fn set_vertical_config<T: Into<Option<VerticalConfig>>>(self, v: T) -> Self

Sets the value of vertical_config.

Note that all the setters affecting vertical_config are mutually exclusive.

§Example
use google_cloud_discoveryengine_v1::model::serving_config::MediaConfig;
let x = ServingConfig::new().set_vertical_config(Some(
    google_cloud_discoveryengine_v1::model::serving_config::VerticalConfig::MediaConfig(MediaConfig::default().into())));
Source

pub fn media_config(&self) -> Option<&Box<MediaConfig>>

The value of vertical_config if it holds a MediaConfig, None if the field is not set or holds a different branch.

Source

pub fn set_media_config<T: Into<Box<MediaConfig>>>(self, v: T) -> Self

Sets the value of vertical_config to hold a MediaConfig.

Note that all the setters affecting vertical_config are mutually exclusive.

§Example
use google_cloud_discoveryengine_v1::model::serving_config::MediaConfig;
let x = ServingConfig::new().set_media_config(MediaConfig::default()/* use setters */);
assert!(x.media_config().is_some());
assert!(x.generic_config().is_none());
Source

pub fn generic_config(&self) -> Option<&Box<GenericConfig>>

The value of vertical_config if it holds a GenericConfig, None if the field is not set or holds a different branch.

Source

pub fn set_generic_config<T: Into<Box<GenericConfig>>>(self, v: T) -> Self

Sets the value of vertical_config to hold a GenericConfig.

Note that all the setters affecting vertical_config are mutually exclusive.

§Example
use google_cloud_discoveryengine_v1::model::serving_config::GenericConfig;
let x = ServingConfig::new().set_generic_config(GenericConfig::default()/* use setters */);
assert!(x.generic_config().is_some());
assert!(x.media_config().is_none());

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> 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>,