# Retail v2 API - Class ServingConfig (2.16.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.16.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig)
- [2.15.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.15.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.14.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.14.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.13.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.13.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.12.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.12.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.11.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.11.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.10.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.10.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.9.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.9.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.8.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.7.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.7.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.6.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.5.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.4.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.3.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.2.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.1.0/Google.Cloud.Retail.V2.ServingConfig)
- [2.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/2.0.0/Google.Cloud.Retail.V2.ServingConfig)
- [1.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.6.0/Google.Cloud.Retail.V2.ServingConfig)
- [1.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.5.0/Google.Cloud.Retail.V2.ServingConfig)
- [1.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.4.0/Google.Cloud.Retail.V2.ServingConfig)
- [1.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.3.0/Google.Cloud.Retail.V2.ServingConfig)
- [1.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.2.0/Google.Cloud.Retail.V2.ServingConfig)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.1.0/Google.Cloud.Retail.V2.ServingConfig)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/1.0.0/Google.Cloud.Retail.V2.ServingConfig)

    public sealed class ServingConfig : IMessage<ServingConfig>, IEquatable<ServingConfig>, IDeepCloneable<ServingConfig>, IBufferMessage, IMessage

Reference documentation and code samples for the Retail v2 API class ServingConfig.

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

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ServingConfig

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[ServingConfig](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[ServingConfig](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[ServingConfig](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Retail.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2)

## Assembly

Google.Cloud.Retail.V2.dll

## Constructors

### ServingConfig()

    public ServingConfig()

### ServingConfig(ServingConfig)

    public ServingConfig(ServingConfig other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig` |

## Properties

### BoostControlIds

    public RepeatedField<string> BoostControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.boost_control_ids\]
and
\[SearchRequest.boost_spec\]\[google.cloud.retail.v2.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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### DisplayName

    public string DisplayName { get; set; }

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.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DiversityLevel

    public string DiversityLevel { get; set; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_RECOMMENDATION\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DiversityType

    public ServingConfig.Types.DiversityType DiversityType { get; set; }

What kind of diversity to use - data driven or rule based. If unset, the
server behavior defaults to
\[RULE_BASED_DIVERSITY\]\[google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfighttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig.Types.DiversityType` |   |

### DoNotAssociateControlIds

    public RepeatedField<string> DoNotAssociateControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### DynamicFacetSpec

    public SearchRequest.Types.DynamicFacetSpec DynamicFacetSpec { get; set; }

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

Can only be set if
\[solution_types\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.SearchRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.SearchRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.SearchRequest.Types.DynamicFacetSpec` |   |

### EnableCategoryFilterLevel

    public string EnableCategoryFilterLevel { get; set; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_RECOMMENDATION\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### FacetControlIds

    public RepeatedField<string> FacetControlIds { get; }

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

Can only be set if
\[solution_types\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### FilterControlIds

    public RepeatedField<string> FilterControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### IgnoreControlIds

    public RepeatedField<string> IgnoreControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### IgnoreRecsDenylist

    public bool IgnoreRecsDenylist { get; set; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### ModelId

    public string ModelId { get; set; }

The id of the model in the same \[Catalog\]\[google.cloud.retail.v2.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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_RECOMMENDATION\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Name

    public string Name { get; set; }

Immutable. Fully qualified name
`projects/*/locations/global/catalogs/*/servingConfig/*`

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### OnewaySynonymsControlIds

    public RepeatedField<string> OnewaySynonymsControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### PersonalizationSpec

    public SearchRequest.Types.PersonalizationSpec PersonalizationSpec { get; set; }

The specification for personalization spec.

Can only be set if
\[solution_types\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

Notice that if both
\[ServingConfig.personalization_spec\]\[google.cloud.retail.v2.ServingConfig.personalization_spec\]
and
\[SearchRequest.personalization_spec\]\[google.cloud.retail.v2.SearchRequest.personalization_spec\]
are set.
\[SearchRequest.personalization_spec\]\[google.cloud.retail.v2.SearchRequest.personalization_spec\]
will override
\[ServingConfig.personalization_spec\]\[google.cloud.retail.v2.ServingConfig.personalization_spec\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.SearchRequesthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.SearchRequest.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.SearchRequest.Types.PersonalizationSpec` |   |

### PriceRerankingLevel

    public string PriceRerankingLevel { get; set; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_RECOMMENDATION\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### RedirectControlIds

    public RepeatedField<string> RedirectControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### ReplacementControlIds

    public RepeatedField<string> ReplacementControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### ServingConfigName

    public ServingConfigName ServingConfigName { get; set; }

[ServingConfigName](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfigName)-typed view over the [Name](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfig#Google_Cloud_Retail_V2_ServingConfig_Name) resource name property.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.ServingConfigName` |   |

### SolutionTypes

    public RepeatedField<SolutionType> SolutionTypes { get; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Retail.V2/latest/Google.Cloud.Retail.V2.SolutionType` |   |

### TwowaySynonymsControlIds

    public RepeatedField<string> TwowaySynonymsControlIds { get; }

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\]\[google.cloud.retail.v2.ServingConfig.solution_types\] is
\[SOLUTION_TYPE_SEARCH\]\[google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH\].

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |