- [Resource: Model](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#Model)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#Model.SCHEMA_REPRESENTATION)
- [PageOptimizationConfig](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#PageOptimizationConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#PageOptimizationConfig.SCHEMA_REPRESENTATION)
- [Panel](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#Panel)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#Panel.SCHEMA_REPRESENTATION)
- [Candidate](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#Candidate)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#Candidate.SCHEMA_REPRESENTATION)
- [Restriction](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#Restriction)
- [TrainingState](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#TrainingState)
- [ServingState](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#ServingState)
- [PeriodicTuningState](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#PeriodicTuningState)
- [DataState](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#DataState)
- [ServingConfigList](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#ServingConfigList)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#ServingConfigList.SCHEMA_REPRESENTATION)
- [ModelFeaturesConfig](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#ModelFeaturesConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#ModelFeaturesConfig.SCHEMA_REPRESENTATION)
- [FrequentlyBoughtTogetherFeaturesConfig](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#FrequentlyBoughtTogetherFeaturesConfig)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#FrequentlyBoughtTogetherFeaturesConfig.SCHEMA_REPRESENTATION)
- [ContextProductsType](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#ContextProductsType)
- [Methods](https://docs.cloud.google.com/gemini-enterprise-cx/ai-commerce-search/reference/rest/v2alpha/projects.locations.catalogs.models.md.txt#METHODS_SUMMARY)

## Resource: Model

Metadata that describes the training and serving parameters of a `Model`. A `Model` can be associated with a `ServingConfig` and then queried through the Predict API.

| JSON representation |
|---|
| ``` { "name": string, "displayName": string, "trainingState": enum (`TrainingState`), "servingState": enum (`ServingState`), "createTime": string, "updateTime": string, "type": string, "optimizationObjective": string, "periodicTuningState": enum (`PeriodicTuningState`), "lastTuneTime": string, "tuningOperation": string, "dataState": enum (`DataState`), "filteringOption": enum (`RecommendationsFilteringOption`), "servingConfigLists": [ { object (`ServingConfigList`) } ], "modelFeaturesConfig": { object (`ModelFeaturesConfig`) }, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "pageOptimizationConfig": { object (`PageOptimizationConfig`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `name` | `string` Required. The fully qualified resource name of the model. Format: `projects/{projectNumber}/locations/{locationId}/catalogs/{catalogId}/models/{modelId}` catalogId has char limit of 50. recommendation_model_id has char limit of 40. |
| `displayName` | `string` Required. The display name of the model. Should be human readable, used to display Recommendation Models in the Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024 characters. |
| `trainingState` | ``enum (`TrainingState`)`` Optional. The training state that the model is in (e.g. `TRAINING` or `PAUSED`). Since part of the cost of running the service is frequency of training - this can be used to determine when to train model in order to control cost. If not specified: the default value for `models.create` method is `TRAINING`. The default value for `models.patch` method is to keep the state the same as before. |
| `servingState` | ``enum (`ServingState`)`` Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`. |
| `createTime` | ``string (`Timestamp` format)`` Output only. Timestamp the Recommendation Model was created at. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`Timestamp` format)`` Output only. Timestamp the Recommendation Model was last updated. E.g. if a Recommendation Model was paused - this would be the time the pause was initiated. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `type` | `string` Required. The type of model e.g. `home-page`. Currently supported values: `recommended-for-you`, `others-you-may-like`, `frequently-bought-together`, `page-optimization`, `similar-items`, `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value). This field together with `optimizationObjective` describe model metadata to use to control model training and serving. See <https://cloud.google.com/retail/docs/models> for more details on what the model metadata control and which combination of parameters are valid. For invalid combinations of parameters (e.g. type = `frequently-bought-together` and optimizationObjective = `ctr`), you receive an error 400 if you try to create/update a recommendation with this set of knobs. |
| `optimizationObjective` | `string` Optional. The optimization objective e.g. `cvr`. Currently supported values: `ctr`, `cvr`, `revenue-per-order`. If not specified, we choose default based on model type. Default depends on type of recommendation: `recommended-for-you` =\> `ctr` `others-you-may-like` =\> `ctr` `frequently-bought-together` =\> `revenue_per_order` This field together with `optimizationObjective` describe model metadata to use to control model training and serving. See <https://cloud.google.com/retail/docs/models> for more details on what the model metadata control and which combination of parameters are valid. For invalid combinations of parameters (e.g. type = `frequently-bought-together` and optimizationObjective = `ctr`), you receive an error 400 if you try to create/update a recommendation with this set of knobs. |
| `periodicTuningState` | ``enum (`PeriodicTuningState`)`` Optional. The state of periodic tuning. The period we use is 3 months - to do a one-off tune earlier use the `models.tune` method. Default value is `PERIODIC_TUNING_ENABLED`. |
| `lastTuneTime` | ``string (`Timestamp` format)`` Output only. The timestamp when the latest successful tune finished. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `tuningOperation` | `string` Output only. The tune operation associated with the model. Can be used to determine if there is an ongoing tune for this recommendation. Empty field implies no tune is goig on. |
| `dataState` | ``enum (`DataState`)`` Output only. The state of data requirements for this model: `DATA_OK` and `DATA_ERROR`. Recommendation model cannot be trained if the data is in `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even if serving state is `ACTIVE`: models were trained successfully before, but cannot be refreshed because model no longer has sufficient data for training. |
| `filteringOption` | ``enum (`RecommendationsFilteringOption`)`` Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering by attributes is enabled for the model. |
| `servingConfigLists[]` | ``object (`ServingConfigList`)`` Output only. The list of valid serving configs associated with the PageOptimizationConfig. |
| `modelFeaturesConfig` | ``object (`ModelFeaturesConfig`)`` Optional. Additional model features config. |
| Training configuration specific to a `Model.type` - currently, only for page optimization. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `pageOptimizationConfig` | ``object (`PageOptimizationConfig`)`` Optional. The page optimization config. |
| End of mutually exclusive fields. ||

## PageOptimizationConfig

The PageOptimizationConfig for model training.

This determines how many panels to optimize for, and which serving configs to consider for each panel. The purpose of this model is to optimize which `ServingConfig` to show on which panels in way that optimizes the visitors shopping journey.

| JSON representation |
|---|
| ``` { "pageOptimizationEventType": string, "panels": [ { object (`Panel`) } ], "restriction": enum (`Restriction`) } ``` |

| Fields ||
|---|---|
| `pageOptimizationEventType` | `string` Required. The type of `UserEvent` this page optimization is shown for. Each page has an associated event type - this will be the corresponding event type for the page that the page optimization model is used on. Supported types: - `add-to-cart`: Products being added to cart. - `detail-page-view`: Products detail page viewed. - `home-page-view`: Homepage viewed - `category-page-view`: Homepage viewed - `shopping-cart-page-view`: User viewing a shopping cart. `home-page-view` only allows models with type `recommended-for-you`. All other pageOptimizationEventType allow all `Model.types`. |
| `panels[]` | ``object (`Panel`)`` Required. A list of panel configurations. Limit = 5. |
| `restriction` | ``enum (`Restriction`)`` Optional. How to restrict results across panels e.g. can the same `ServingConfig` be shown on multiple panels at once. If unspecified, default to `UNIQUE_MODEL_RESTRICTION`. |

## Panel

An individual panel with a list of `ServingConfigs` to consider for it.

| JSON representation |
|---|
| ``` { "displayName": string, "candidates": [ { object (`Candidate`) } ], "defaultCandidate": { object (`Candidate`) } } ``` |

| Fields ||
|---|---|
| `displayName` | `string` Optional. The name to display for the panel. |
| `candidates[]` | ``object (`Candidate`)`` Required. The candidates to consider on the panel. |
| `defaultCandidate` | ``object (`Candidate`)`` Required. The default candidate. If the model fails at serving time, we fall back to the default. |

## Candidate

A candidate to consider for a given panel. Currently only `ServingConfig` are valid candidates.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "servingConfigId": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `servingConfigId` | `string` This has to be a valid `ServingConfig` identifier. For example, for a ServingConfig with full name: `projects/*/locations/global/catalogs/default_catalog/servingConfigs/my_candidate_config`, this would be `my_candidate_config`. |
| End of mutually exclusive fields. ||

## Restriction

Restrictions of expected returned results.

| Enums ||
|---|---|
| `RESTRICTION_UNSPECIFIED` | Unspecified value for restriction. |
| `NO_RESTRICTION` | Allow any `ServingConfig` to be show on any number of panels. Example: `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity `Panel2 candidates`: home_page_ctr_no_diversity, home_page_ctr_diversity, pdp_cvr_no_diversity `Restriction` = NO_RESTRICTION `Valid combinations`: - * (pdp_ctr, home_page_ctr_no_diversity)* * - (pdp_ctr, home_page_ctr_diversity) - (pdp_ctr, pdp_cvr_no_diversity) - (pdp_cvr, home_page_ctr_no_diversity) - (pdp_cvr, home_page_ctr_diversity) - (pdp_cvr, pdp_cvr_no_diversity) - (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - (home_page_ctr_no_diversity, home_page_ctr_diversity) * - *(home_page_ctr_no_diversity, pdp_cvr_no_diversity) * `Invalid combinations`: \[\] |
| `UNIQUE_SERVING_CONFIG_RESTRICTION` | Do not allow the same `ServingConfig.name` to be shown on multiple panels. Example: `Panel1 candidates`: * pdp_ctr, pdp_cvr, home_page_ctr_no_diversity * `Panel2 candidates`: * home_page_ctr_no_diversity, home_page_ctr_diversity_low, pdp_cvr_no_diversity * `Restriction` = `UNIQUE_SERVING_CONFIG_RESTRICTION` `Valid combinations`: - * (pdp_ctr, home_page_ctr_no_diversity)* * - (pdp_ctr, home_page_ctr_diversity_low) - (pdp_ctr, pdp_cvr_no_diversity) - (pdp_ctr, pdp_cvr_no_diversity) - (pdp_cvr, home_page_ctr_no_diversity) - (pdp_cvr, home_page_ctr_diversity_low) - (pdp_cvr, pdp_cvr_no_diversity) - (home_page_ctr_no_diversity, home_page_ctr_diversity_low) * - *(home_page_ctr_no_diversity, pdp_cvr_no_diversity) * `Invalid combinations`: - * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) * |
| `UNIQUE_MODEL_RESTRICTION` | Do not allow multiple `ServingConfigs` with same `Model.name` to be show on on different panels. Example: `Panel1 candidates`: * pdp_ctr, pdp_cvr, home_page_ctr_no_diversity * `Panel2 candidates`: * home_page_ctr_no_diversity, home_page_ctr_diversity_low, pdp_cvr_no_diversity * `Restriction` = `UNIQUE_MODEL_RESTRICTION` `Valid combinations`: - * (pdp_ctr, home_page_ctr_no_diversity)* * - (pdp_ctr, home_page_ctr_diversity) - (pdp_ctr, pdp_cvr_no_diversity) - (pdp_ctr, pdp_cvr_no_diversity) - (pdp_cvr, home_page_ctr_no_diversity) - (pdp_cvr, home_page_ctr_diversity_low) * - *(home_page_ctr_no_diversity, pdp_cvr_no_diversity) * `Invalid combinations`: - * (home_page_ctr_no_diversity, home_page_ctr_no_diversity)* * * - *(pdp_cvr, pdp_cvr_no_diversity) * |
| `UNIQUE_MODEL_TYPE_RESTRICTION` | Do not allow multiple `ServingConfigs` with same `Model.type` to be shown on different panels. Example: `Panel1 candidates`: * pdp_ctr, pdp_cvr, home_page_ctr_no_diversity * `Panel2 candidates`: * home_page_ctr_no_diversity, home_page_ctr_diversity_low, pdp_cvr_no_diversity * `Restriction` = `UNIQUE_MODEL_RESTRICTION` `Valid combinations`: - * (pdp_ctr, home_page_ctr_no_diversity)* * - (pdp_ctr, home_page_ctr_diversity) - (pdp_cvr, home_page_ctr_no_diversity) - (pdp_cvr, home_page_ctr_diversity_low) * - *(home_page_ctr_no_diversity, pdp_cvr_no_diversity) * `Invalid combinations`: - * (pdp_ctr, pdp_cvr_no_diversity)* * - (pdp_ctr, pdp_cvr_no_diversity) - (pdp_cvr, pdp_cvr_no_diversity) - (home_page_ctr_no_diversity, home_page_ctr_no_diversity) * - *(home_page_ctr_no_diversity, home_page_ctr_diversity) * |

## TrainingState

The training state of the model.

| Enums ||
|---|---|
| `TRAINING_STATE_UNSPECIFIED` | Unspecified training state. |
| `PAUSED` | The model training is paused. |
| `TRAINING` | The model is training. |

## ServingState

The serving state of the model.

| Enums ||
|---|---|
| `SERVING_STATE_UNSPECIFIED` | Unspecified serving state. |
| `INACTIVE` | The model is not serving. |
| `ACTIVE` | The model is serving and can be queried. |
| `TUNED` | The model is trained on tuned hyperparameters and can be queried. |

## PeriodicTuningState

Describes whether periodic tuning is enabled for this model or not. Periodic tuning is scheduled at most every three months. You can start a tuning process manually by using the `models.tune` method, which starts a tuning process immediately and resets the quarterly schedule. Enabling or disabling periodic tuning does not affect any current tuning processes.

| Enums ||
|---|---|
| `PERIODIC_TUNING_STATE_UNSPECIFIED` | Unspecified default value, should never be explicitly set. |
| `PERIODIC_TUNING_DISABLED` | The model has periodic tuning disabled. Tuning can be reenabled by calling the `EnableModelPeriodicTuning` method or by calling the `models.tune` method. |
| `ALL_TUNING_DISABLED` | The model cannot be tuned with periodic tuning OR the `models.tune` method. Hide the options in customer UI and reject any requests through the backend self serve API. |
| `PERIODIC_TUNING_ENABLED` | The model has periodic tuning enabled. Tuning can be disabled by calling the `DisableModelPeriodicTuning` method. |

## DataState

Describes whether this model have sufficient training data to be continuously trained.

| Enums ||
|---|---|
| `DATA_STATE_UNSPECIFIED` | Unspecified default value, should never be explicitly set. |
| `DATA_OK` | The model has sufficient training data. |
| `DATA_ERROR` | The model does not have sufficient training data. Error messages can be queried via Stackdriver. |

## ServingConfigList

Represents an ordered combination of valid serving configs, which can be used for `PAGE_OPTIMIZATION` recommendations.

| JSON representation |
|---|
| ``` { "servingConfigIds": [ string ] } ``` |

| Fields ||
|---|---|
| `servingConfigIds[]` | `string` Optional. A set of valid serving configs that may be used for `PAGE_OPTIMIZATION`. |

## ModelFeaturesConfig

Additional model features config.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "frequentlyBoughtTogetherConfig": { object (`FrequentlyBoughtTogetherFeaturesConfig`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `frequentlyBoughtTogetherConfig` | ``object (`FrequentlyBoughtTogetherFeaturesConfig`)`` Additional configs for frequently-bought-together models. |
| End of mutually exclusive fields. ||

## FrequentlyBoughtTogetherFeaturesConfig

Additional configs for the frequently-bought-together model type.

| JSON representation |
|---|
| ``` { "contextProductsType": enum (`ContextProductsType`) } ``` |

| Fields ||
|---|---|
| `contextProductsType` | ``enum (`ContextProductsType`)`` Optional. Specifies the context of the model when it is used in predict requests. Can only be set for the `frequently-bought-together` type. If it isn't specified, it defaults to `MULTIPLE_CONTEXT_PRODUCTS`. |

## ContextProductsType

Use single or multiple context products for recommendations.

| Enums ||
|---|---|
| `CONTEXT_PRODUCTS_TYPE_UNSPECIFIED` | Unspecified default value, should never be explicitly set. Defaults to `MULTIPLE_CONTEXT_PRODUCTS`. |
| `SINGLE_CONTEXT_PRODUCT` | Use only a single product as context for the recommendation. Typically used on pages like add-to-cart or product details. |
| `MULTIPLE_CONTEXT_PRODUCTS` | Use one or multiple products as context for the recommendation. Typically used on shopping cart pages. |

| ## Methods ||
|---|---|
| ### `create` | Creates a new model. |
| ### `delete` | Deletes an existing model. |
| ### `get` | Gets a model. |
| ### `list` | Lists all the models linked to this event store. |
| ### `patch` | Update of model metadata. |
| ### `pause` | Pauses the training of an existing model. |
| ### `resume` | Resumes the training of an existing model. |
| ### `tune` | Tunes an existing model. |