As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Recommendationengine v1beta1 API

class google.cloud.recommendationengine_v1beta1.types.CatalogInlineSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The inline source for the input config for ImportCatalogItems method.

catalog_items

Optional. A list of catalog items to update/create. Recommended max of 10k items.

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.CatalogItem]

class google.cloud.recommendationengine_v1beta1.types.CatalogItem(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

CatalogItem captures all metadata information of items to be recommended.

id

Required. Catalog item identifier. UTF-8 encoded string with a length limit of 128 bytes.

This id must be unique among all catalog items within the same catalog. It should also be used when logging user events in order for the user events to be joined with the Catalog.

Type

str

category_hierarchies

Required. Catalog item categories. This field is repeated for supporting one catalog item belonging to several parallel category hierarchies.

For example, if a shoes product belongs to both [“Shoes & Accessories” -> “Shoes”] and [“Sports & Fitness” -> “Athletic Clothing” -> “Shoes”], it could be represented as:

"categoryHierarchies": [
  { "categories": ["Shoes & Accessories", "Shoes"]},
  { "categories": ["Sports & Fitness", "Athletic Clothing", "Shoes"] }
]
Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.CatalogItem.CategoryHierarchy]

title

Required. Catalog item title. UTF-8 encoded string with a length limit of 1 KiB.

Type

str

description

Optional. Catalog item description. UTF-8 encoded string with a length limit of 5 KiB.

Type

str

item_attributes

Optional. Highly encouraged. Extra catalog item attributes to be included in the recommendation model. For example, for retail products, this could include the store name, vendor, style, color, etc. These are very strong signals for recommendation model, thus we highly recommend providing the item attributes here.

Type

google.cloud.recommendationengine_v1beta1.types.FeatureMap

language_code

Optional. Language of the title/description/item_attributes. Use language tags defined by BCP 47. https://www.rfc-editor.org/rfc/bcp/bcp47.txt. Our supported language codes include ‘en’, ‘es’, ‘fr’, ‘de’, ‘ar’, ‘fa’, ‘zh’, ‘ja’, ‘ko’, ‘sv’, ‘ro’, ‘nl’. For other languages, contact your Google account manager.

Type

str

tags

Optional. Filtering tags associated with the catalog item. Each tag should be a UTF-8 encoded string with a length limit of 1 KiB.

This tag can be used for filtering recommendation results by passing the tag as part of the predict request filter.

Type

MutableSequence[str]

item_group_id

Optional. Variant group identifier for prediction results. UTF-8 encoded string with a length limit of 128 bytes.

This field must be enabled before it can be used. Learn more.

Type

str

product_metadata

Optional. Metadata specific to retail products.

This field is a member of oneof recommendation_type.

Type

google.cloud.recommendationengine_v1beta1.types.ProductCatalogItem

class CategoryHierarchy(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Category represents catalog item category hierarchy.

categories

Required. Catalog item categories. Each category should be a UTF-8 encoded string with a length limit of 2 KiB.

Note that the order in the list denotes the specificity (from least to most specific).

Type

MutableSequence[str]

class google.cloud.recommendationengine_v1beta1.types.CollectUserEventRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for CollectUserEvent method.

parent

Required. The parent eventStore name, such as projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store.

Type

str

user_event

Required. URL encoded UserEvent proto.

Type

str

uri

Optional. The url including cgi-parameters but excluding the hash fragment. The URL must be truncated to 1.5K bytes to conservatively be under the 2K bytes. This is often more useful than the referer url, because many browsers only send the domain for 3rd party requests.

Type

str

ets

Optional. The event timestamp in milliseconds. This prevents browser caching of otherwise identical get requests. The name is abbreviated to reduce the payload bytes.

Type

int

class google.cloud.recommendationengine_v1beta1.types.CreateCatalogItemRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for CreateCatalogItem method.

parent

Required. The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.

Type

str

catalog_item

Required. The catalog item to create.

Type

google.cloud.recommendationengine_v1beta1.types.CatalogItem

class google.cloud.recommendationengine_v1beta1.types.CreatePredictionApiKeyRegistrationRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the CreatePredictionApiKeyRegistration method.

parent

Required. The parent resource path. projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store.

Type

str

prediction_api_key_registration

Required. The prediction API key registration.

Type

google.cloud.recommendationengine_v1beta1.types.PredictionApiKeyRegistration

class google.cloud.recommendationengine_v1beta1.types.DeleteCatalogItemRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for DeleteCatalogItem method.

name

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id.

Type

str

class google.cloud.recommendationengine_v1beta1.types.DeletePredictionApiKeyRegistrationRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for DeletePredictionApiKeyRegistration method.

name

Required. The API key to unregister including full resource path. projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/<YOUR_API_KEY>

Type

str

class google.cloud.recommendationengine_v1beta1.types.EventDetail(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

User event details shared by all recommendation types.

uri

Optional. Complete url (window.location.href) of the user’s current page. When using the JavaScript pixel, this value is filled in automatically. Maximum length 5KB.

Type

str

referrer_uri

Optional. The referrer url of the current page. When using the JavaScript pixel, this value is filled in automatically.

Type

str

page_view_id

Optional. A unique id of a web page view. This should be kept the same for all user events triggered from the same pageview. For example, an item detail page view could trigger multiple events as the user is browsing the page. The pageViewId property should be kept the same for all these events so that they can be grouped together properly. This pageViewId will be automatically generated if using the JavaScript pixel.

Type

str

experiment_ids

Optional. A list of identifiers for the independent experiment groups this user event belongs to. This is used to distinguish between user events associated with different experiment setups (e.g. using Recommendation Engine system, using different recommendation models).

Type

MutableSequence[str]

recommendation_token

Optional. Recommendation token included in the recommendation prediction response.

This field enables accurate attribution of recommendation model performance.

This token enables us to accurately attribute page view or purchase back to the event and the particular predict response containing this clicked/purchased item. If user clicks on product K in the recommendation results, pass the PredictResponse.recommendationToken property as a url parameter to product K’s page. When recording events on product K’s page, log the PredictResponse.recommendation_token to this field.

Optional, but highly encouraged for user events that are the result of a recommendation prediction query.

Type

str

event_attributes

Optional. Extra user event features to include in the recommendation model.

For product recommendation, an example of extra user information is traffic_channel, i.e. how user arrives at the site. Users can arrive at the site by coming to the site directly, or coming through Google search, and etc.

Type

google.cloud.recommendationengine_v1beta1.types.FeatureMap

class google.cloud.recommendationengine_v1beta1.types.FeatureMap(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

FeatureMap represents extra features that customers want to include in the recommendation model for catalogs/user events as categorical/numerical features.

categorical_features

Categorical features that can take on one of a limited number of possible values. Some examples would be the brand/maker of a product, or country of a customer.

Feature names and values must be UTF-8 encoded strings.

For example: { "colors": {"value": ["yellow", "green"]}, "sizes": {"value":["S", "M"]}

Type

MutableMapping[str, google.cloud.recommendationengine_v1beta1.types.FeatureMap.StringList]

numerical_features

Numerical features. Some examples would be the height/weight of a product, or age of a customer.

Feature names must be UTF-8 encoded strings.

For example: { "lengths_cm": {"value":[2.3, 15.4]}, "heights_cm": {"value":[8.1, 6.4]} }

Type

MutableMapping[str, google.cloud.recommendationengine_v1beta1.types.FeatureMap.FloatList]

class CategoricalFeaturesEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class FloatList(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A list of float features.

value

Float feature value.

Type

MutableSequence[float]

class NumericalFeaturesEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class StringList(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A list of string features.

value

String feature value with a length limit of 128 bytes.

Type

MutableSequence[str]

class google.cloud.recommendationengine_v1beta1.types.GcsSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Google Cloud Storage location for input content. format.

input_uris

Required. Google Cloud Storage URIs to input files. URI can be up to 2000 characters long. URIs can match the full object path (for example, gs://bucket/directory/object.json) or a pattern matching one or more files, such as gs://bucket/directory/*.json. A request can contain at most 100 files, and each file can be up to 2 GB. See Importing catalog information for the expected file format and setup instructions.

Type

MutableSequence[str]

class google.cloud.recommendationengine_v1beta1.types.GetCatalogItemRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for GetCatalogItem method.

name

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogitems/some_catalog_item_id.

Type

str

class google.cloud.recommendationengine_v1beta1.types.Image(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Catalog item thumbnail/detail image.

uri

Required. URL of the image with a length limit of 5 KiB.

Type

str

height

Optional. Height of the image in number of pixels.

Type

int

width

Optional. Width of the image in number of pixels.

Type

int

class google.cloud.recommendationengine_v1beta1.types.ImportCatalogItemsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for Import methods.

parent

Required. projects/1234/locations/global/catalogs/default_catalog

Type

str

request_id

Optional. Unique identifier provided by client, within the ancestor dataset scope. Ensures idempotency and used for request deduplication. Server-generated if unspecified. Up to 128 characters long. This is returned as google.longrunning.Operation.name in the response.

Type

str

input_config

Required. The desired input location of the data.

Type

google.cloud.recommendationengine_v1beta1.types.InputConfig

errors_config

Optional. The desired location of errors incurred during the Import.

Type

google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig

class google.cloud.recommendationengine_v1beta1.types.ImportCatalogItemsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response of the ImportCatalogItemsRequest. If the long running operation is done, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

error_samples

A sample of errors encountered while processing the request.

Type

MutableSequence[google.rpc.status_pb2.Status]

errors_config

Echoes the destination for the complete errors in the request if set.

Type

google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig

class google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Configuration of destination for Import related errors.

gcs_prefix

Google Cloud Storage path for import errors. This must be an empty, existing Cloud Storage bucket. Import errors will be written to a file in this bucket, one per line, as a JSON-encoded google.rpc.Status message.

This field is a member of oneof destination.

Type

str

class google.cloud.recommendationengine_v1beta1.types.ImportMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata related to the progress of the Import operation. This will be returned by the google.longrunning.Operation.metadata field.

operation_name

Name of the operation.

Type

str

request_id

Id of the request / operation. This is parroting back the requestId that was passed in the request.

Type

str

create_time

Operation create time.

Type

google.protobuf.timestamp_pb2.Timestamp

success_count

Count of entries that were processed successfully.

Type

int

failure_count

Count of entries that encountered errors while processing.

Type

int

update_time

Operation last update time. If the operation is done, this is also the finish time.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.recommendationengine_v1beta1.types.ImportUserEventsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the ImportUserEvents request.

parent

Required. projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store

Type

str

request_id

Optional. Unique identifier provided by client, within the ancestor dataset scope. Ensures idempotency for expensive long running operations. Server-generated if unspecified. Up to 128 characters long. This is returned as google.longrunning.Operation.name in the response. Note that this field must not be set if the desired input config is catalog_inline_source.

Type

str

input_config

Required. The desired input location of the data.

Type

google.cloud.recommendationengine_v1beta1.types.InputConfig

errors_config

Optional. The desired location of errors incurred during the Import.

Type

google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig

class google.cloud.recommendationengine_v1beta1.types.ImportUserEventsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response of the ImportUserEventsRequest. If the long running operation was successful, then this message is returned by the google.longrunning.Operations.response field if the operation was successful.

error_samples

A sample of errors encountered while processing the request.

Type

MutableSequence[google.rpc.status_pb2.Status]

errors_config

Echoes the destination for the complete errors if this field was set in the request.

Type

google.cloud.recommendationengine_v1beta1.types.ImportErrorsConfig

import_summary

Aggregated statistics of user event import status.

Type

google.cloud.recommendationengine_v1beta1.types.UserEventImportSummary

class google.cloud.recommendationengine_v1beta1.types.InputConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The input config source.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

catalog_inline_source

The Inline source for the input content for Catalog items.

This field is a member of oneof source.

Type

google.cloud.recommendationengine_v1beta1.types.CatalogInlineSource

gcs_source

Google Cloud Storage location for the input content.

This field is a member of oneof source.

Type

google.cloud.recommendationengine_v1beta1.types.GcsSource

user_event_inline_source

The Inline source for the input content for UserEvents.

This field is a member of oneof source.

Type

google.cloud.recommendationengine_v1beta1.types.UserEventInlineSource

class google.cloud.recommendationengine_v1beta1.types.ListCatalogItemsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for ListCatalogItems method.

parent

Required. The parent catalog resource name, such as projects/*/locations/global/catalogs/default_catalog.

Type

str

page_size

Optional. Maximum number of results to return per page. If zero, the service will choose a reasonable default.

Type

int

page_token

Optional. The previous ListCatalogItemsResponse.next_page_token.

Type

str

filter

Optional. A filter to apply on the list results.

Type

str

class google.cloud.recommendationengine_v1beta1.types.ListCatalogItemsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for ListCatalogItems method.

catalog_items

The catalog items.

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.CatalogItem]

next_page_token

If empty, the list is complete. If nonempty, the token to pass to the next request’s ListCatalogItemRequest.page_token.

Type

str

class google.cloud.recommendationengine_v1beta1.types.ListPredictionApiKeyRegistrationsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the ListPredictionApiKeyRegistrations.

parent

Required. The parent placement resource name such as projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store

Type

str

page_size

Optional. Maximum number of results to return per page. If unset, the service will choose a reasonable default.

Type

int

page_token

Optional. The previous ListPredictionApiKeyRegistration.nextPageToken.

Type

str

class google.cloud.recommendationengine_v1beta1.types.ListPredictionApiKeyRegistrationsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for the ListPredictionApiKeyRegistrations.

prediction_api_key_registrations

The list of registered API keys.

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.PredictionApiKeyRegistration]

next_page_token

If empty, the list is complete. If nonempty, pass the token to the next request’s ListPredictionApiKeysRegistrationsRequest.pageToken.

Type

str

class google.cloud.recommendationengine_v1beta1.types.ListUserEventsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for ListUserEvents method.

parent

Required. The parent eventStore resource name, such as projects/*/locations/*/catalogs/default_catalog/eventStores/default_event_store.

Type

str

page_size

Optional. Maximum number of results to return per page. If zero, the service will choose a reasonable default.

Type

int

page_token

Optional. The previous ListUserEventsResponse.next_page_token.

Type

str

filter

Optional. Filtering expression to specify restrictions over returned events. This is a sequence of terms, where each term applies some kind of a restriction to the returned user events. Use this expression to restrict results to a specific time range, or filter events by eventType. eg: eventTime > “2012-04-23T18:25:43.511Z” eventsMissingCatalogItems eventTime<”2012-04-23T18:25:43.511Z” eventType=search

We expect only 3 types of fields:

* eventTime: this can be specified a maximum of 2 times, once with a
  less than operator and once with a greater than operator. The
  eventTime restrict should result in one contiguous valid eventTime
  range.

* eventType: only 1 eventType restriction can be specified.

* eventsMissingCatalogItems: specififying this will restrict results
  to events for which catalog items were not found in the catalog. The
  default behavior is to return only those events for which catalog
  items were found.

Some examples of valid filters expressions:

  • Example 1: eventTime > “2012-04-23T18:25:43.511Z” eventTime < “2012-04-23T18:30:43.511Z”

  • Example 2: eventTime > “2012-04-23T18:25:43.511Z” eventType = detail-page-view

  • Example 3: eventsMissingCatalogItems eventType = search eventTime < “2018-04-23T18:30:43.511Z”

  • Example 4: eventTime > “2012-04-23T18:25:43.511Z”

  • Example 5: eventType = search

  • Example 6: eventsMissingCatalogItems

Type

str

class google.cloud.recommendationengine_v1beta1.types.ListUserEventsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for ListUserEvents method.

user_events

The user events.

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.UserEvent]

next_page_token

If empty, the list is complete. If nonempty, the token to pass to the next request’s ListUserEvents.page_token.

Type

str

class google.cloud.recommendationengine_v1beta1.types.PredictRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for Predict method.

name

Required. Full resource name of the format: {name=projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/*} The id of the recommendation engine placement. This id is used to identify the set of models that will be used to make the prediction.

We currently support three placements with the following IDs by default:

  • shopping_cart: Predicts items frequently bought together with one or more catalog items in the same shopping session. Commonly displayed after add-to-cart events, on product detail pages, or on the shopping cart page.

  • home_page: Predicts the next product that a user will most likely engage with or purchase based on the shopping or viewing history of the specified userId or visitorId. For example - Recommendations for you.

  • product_detail: Predicts the next product that a user will most likely engage with or purchase. The prediction is based on the shopping or viewing history of the specified userId or visitorId and its relevance to a specified CatalogItem. Typically used on product detail pages. For example - More items like this.

  • recently_viewed_default: Returns up to 75 items recently viewed by the specified userId or visitorId, most recent ones first. Returns nothing if neither of them has viewed any items yet. For example - Recently viewed.

The full list of available placements can be seen at https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard

Type

str

user_event

Required. Context about the user, what they are looking at and what action they took to trigger the predict request. Note that this user event detail won’t be ingested to userEvent logs. Thus, a separate userEvent write request is required for event logging.

Type

google.cloud.recommendationengine_v1beta1.types.UserEvent

page_size

Optional. Maximum number of results to return per page. Set this property to the number of prediction results required. If zero, the service will choose a reasonable default.

Type

int

page_token

Optional. The previous PredictResponse.next_page_token.

Type

str

filter

Optional. Filter for restricting prediction results. Accepts values for tags and the filterOutOfStockItems flag.

  • Tag expressions. Restricts predictions to items that match all of the specified tags. Boolean operators OR and NOT are supported if the expression is enclosed in parentheses, and must be separated from the tag values by a space. -"tagA" is also supported and is equivalent to NOT "tagA". Tag values must be double quoted UTF-8 encoded strings with a size limit of 1 KiB.

  • filterOutOfStockItems. Restricts predictions to items that do not have a stockState value of OUT_OF_STOCK.

Examples:

  • tag=(“Red” OR “Blue”) tag=”New-Arrival” tag=(NOT “promotional”)

  • filterOutOfStockItems tag=(-“promotional”)

  • filterOutOfStockItems

Type

str

dry_run

Optional. Use dryRun mode for this prediction query. If set to true, a dummy model will be used that returns arbitrary catalog items. Note that the dryRun mode should only be used for testing the API, or if the model is not ready.

Type

bool

params

Optional. Additional domain specific parameters for the predictions.

Allowed values:

  • returnCatalogItem: Boolean. If set to true, the associated catalogItem object will be returned in the PredictResponse.PredictionResult.itemMetadata object in the method response.

  • returnItemScore: Boolean. If set to true, the prediction ‘score’ corresponding to each returned item will be set in the metadata field in the prediction response. The given ‘score’ indicates the probability of an item being clicked/purchased given the user’s context and history.

Type

MutableMapping[str, google.protobuf.struct_pb2.Value]

labels

Optional. The labels for the predict request.

  • Label keys can contain lowercase letters, digits and hyphens, must start with a letter, and must end with a letter or digit.

  • Non-zero label values can contain lowercase letters, digits and hyphens, must start with a letter, and must end with a letter or digit.

  • No more than 64 labels can be associated with a given request.

See https://goo.gl/xmQnxf for more information on and examples of labels.

Type

MutableMapping[str, str]

class LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class ParamsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.recommendationengine_v1beta1.types.PredictResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for predict method.

results

A list of recommended items. The order represents the ranking (from the most relevant item to the least).

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.PredictResponse.PredictionResult]

recommendation_token

A unique recommendation token. This should be included in the user event logs resulting from this recommendation, which enables accurate attribution of recommendation model performance.

Type

str

items_missing_in_catalog

IDs of items in the request that were missing from the catalog.

Type

MutableSequence[str]

dry_run

True if the dryRun property was set in the request.

Type

bool

metadata

Additional domain specific prediction response metadata.

Type

MutableMapping[str, google.protobuf.struct_pb2.Value]

next_page_token

If empty, the list is complete. If nonempty, the token to pass to the next request’s PredictRequest.page_token.

Type

str

class MetadataEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class PredictionResult(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

PredictionResult represents the recommendation prediction results.

id

ID of the recommended catalog item

Type

str

item_metadata

Additional item metadata / annotations.

Possible values:

  • catalogItem: JSON representation of the catalogItem. Will be set if returnCatalogItem is set to true in PredictRequest.params.

  • score: Prediction score in double value. Will be set if returnItemScore is set to true in PredictRequest.params.

Type

MutableMapping[str, google.protobuf.struct_pb2.Value]

class ItemMetadataEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.recommendationengine_v1beta1.types.PredictionApiKeyRegistration(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Registered Api Key.

api_key

The API key.

Type

str

class google.cloud.recommendationengine_v1beta1.types.ProductCatalogItem(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

ProductCatalogItem captures item metadata specific to retail products.

This message has oneof fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

exact_price

Optional. The exact product price.

This field is a member of oneof price.

Type

google.cloud.recommendationengine_v1beta1.types.ProductCatalogItem.ExactPrice

price_range

Optional. The product price range.

This field is a member of oneof price.

Type

google.cloud.recommendationengine_v1beta1.types.ProductCatalogItem.PriceRange

costs

Optional. A map to pass the costs associated with the product.

For example: {“manufacturing”: 45.5} The profit of selling this item is computed like so:

  • If ‘exactPrice’ is provided, profit = displayPrice - sum(costs)

  • If ‘priceRange’ is provided, profit = minPrice - sum(costs)

Type

MutableMapping[str, float]

currency_code

Optional. Only required if the price is set. Currency code for price/costs. Use three-character ISO-4217 code.

Type

str

stock_state

Optional. Online stock state of the catalog item. Default is IN_STOCK.

Type

google.cloud.recommendationengine_v1beta1.types.ProductCatalogItem.StockState

available_quantity

Optional. The available quantity of the item.

Type

int

canonical_product_uri

Optional. Canonical URL directly linking to the item detail page with a length limit of 5 KiB..

Type

str

images

Optional. Product images for the catalog item.

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.Image]

class CostsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class ExactPrice(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Exact product price.

display_price

Optional. Display price of the product.

Type

float

original_price

Optional. Price of the product without any discount. If zero, by default set to be the ‘displayPrice’.

Type

float

class PriceRange(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Product price range when there are a range of prices for different variations of the same product.

min_

Required. The minimum product price.

Type

float

max_

Required. The maximum product price.

Type

float

class StockState(value)[source]

Bases: proto.enums.Enum

Item stock state. If this field is unspecified, the item is assumed to be in stock.

Values:
STOCK_STATE_UNSPECIFIED (0):

Default item stock status. Should never be used.

IN_STOCK (0):

Item in stock.

OUT_OF_STOCK (1):

Item out of stock.

PREORDER (2):

Item that is in pre-order state.

BACKORDER (3):

Item that is back-ordered (i.e. temporarily out of stock).

class google.cloud.recommendationengine_v1beta1.types.ProductDetail(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detailed product information associated with a user event.

id

Required. Catalog item ID. UTF-8 encoded string with a length limit of 128 characters.

Type

str

currency_code

Optional. Currency code for price/costs. Use three-character ISO-4217 code. Required only if originalPrice or displayPrice is set.

Type

str

original_price

Optional. Original price of the product. If provided, this will override the original price in Catalog for this product.

Type

float

display_price

Optional. Display price of the product (e.g. discounted price). If provided, this will override the display price in Catalog for this product.

Type

float

stock_state

Optional. Item stock state. If provided, this overrides the stock state in Catalog for items in this event.

Type

google.cloud.recommendationengine_v1beta1.types.ProductCatalogItem.StockState

quantity

Optional. Quantity of the product associated with the user event. For example, this field will be 2 if two products are added to the shopping cart for add-to-cart event. Required for add-to-cart, add-to-list, remove-from-cart, checkout-start, purchase-complete, refund event types.

Type

int

available_quantity

Optional. Quantity of the products in stock when a user event happens. Optional. If provided, this overrides the available quantity in Catalog for this event. and can only be set if stock_status is set to IN_STOCK.

Note that if an item is out of stock, you must set the stock_state field to be OUT_OF_STOCK. Leaving this field unspecified / as zero is not sufficient to mark the item out of stock.

Type

int

item_attributes

Optional. Extra features associated with a product in the user event.

Type

google.cloud.recommendationengine_v1beta1.types.FeatureMap

class google.cloud.recommendationengine_v1beta1.types.ProductEventDetail(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

ProductEventDetail captures user event information specific to retail products.

search_query

Required for search events. Other event types should not set this field. The user’s search query as UTF-8 encoded text with a length limit of 5 KiB.

Type

str

page_categories

Required for category-page-view events. Other event types should not set this field. The categories associated with a category page. Category pages include special pages such as sales or promotions. For instance, a special sale page may have the category hierarchy: categories : [“Sales”, “2017 Black Friday Deals”].

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.CatalogItem.CategoryHierarchy]

product_details

The main product details related to the event.

This field is required for the following event types:

  • add-to-cart

  • add-to-list

  • checkout-start

  • detail-page-view

  • purchase-complete

  • refund

  • remove-from-cart

  • remove-from-list

This field is optional for the following event types:

  • page-visit

  • shopping-cart-page-view - note that ‘product_details’ should be set for this unless the shopping cart is empty.

This field is not allowed for the following event types:

  • category-page-view

  • home-page-view

  • search

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.ProductDetail]

list_id

Required for add-to-list and remove-from-list events. The id or name of the list that the item is being added to or removed from. Other event types should not set this field.

Type

str

cart_id

Optional. The id or name of the associated shopping cart. This id is used to associate multiple items added or present in the cart before purchase.

This can only be set for add-to-cart, remove-from-cart, checkout-start, purchase-complete, or shopping-cart-page-view events.

Type

str

purchase_transaction

Optional. A transaction represents the entire purchase transaction. Required for purchase-complete events. Optional for checkout-start events. Other event types should not set this field.

Type

google.cloud.recommendationengine_v1beta1.types.PurchaseTransaction

class google.cloud.recommendationengine_v1beta1.types.PurchaseTransaction(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A transaction represents the entire purchase transaction.

id

Optional. The transaction ID with a length limit of 128 bytes.

Type

str

revenue

Required. Total revenue or grand total associated with the transaction. This value include shipping, tax, or other adjustments to total revenue that you want to include as part of your revenue calculations. This field is not required if the event type is refund.

Type

float

taxes

Optional. All the taxes associated with the transaction.

Type

MutableMapping[str, float]

costs

Optional. All the costs associated with the product. These can be manufacturing costs, shipping expenses not borne by the end user, or any other costs.

Total product cost such that profit = revenue - (sum(taxes) + sum(costs)) If product_cost is not set, then profit = revenue - tax - shipping - sum(CatalogItem.costs).

If CatalogItem.cost is not specified for one of the items, CatalogItem.cost based profit cannot be calculated for this Transaction.

Type

MutableMapping[str, float]

currency_code

Required. Currency code. Use three-character ISO-4217 code. This field is not required if the event type is refund.

Type

str

class CostsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class TaxesEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Bases: proto.message.Message

class google.cloud.recommendationengine_v1beta1.types.PurgeUserEventsMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata related to the progress of the PurgeUserEvents operation. This will be returned by the google.longrunning.Operation.metadata field.

operation_name

The ID of the request / operation.

Type

str

create_time

Operation create time.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.recommendationengine_v1beta1.types.PurgeUserEventsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for PurgeUserEvents method.

parent

Required. The resource name of the event_store under which the events are created. The format is projects/${projectId}/locations/global/catalogs/${catalogId}/eventStores/${eventStoreId}

Type

str

filter

Required. The filter string to specify the events to be deleted. Empty string filter is not allowed. This filter can also be used with ListUserEvents API to list events that will be deleted. The eligible fields for filtering are:

  • eventType - UserEvent.eventType field of type string.

  • eventTime - in ISO 8601 “zulu” format.

  • visitorId - field of type string. Specifying this will delete all events associated with a visitor.

  • userId - field of type string. Specifying this will delete all events associated with a user. Example 1: Deleting all events in a time range. eventTime > "2012-04-23T18:25:43.511Z" eventTime < "2012-04-23T18:30:43.511Z" Example 2: Deleting specific eventType in time range. eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view" Example 3: Deleting all events for a specific visitor visitorId = visitor1024 The filtering fields are assumed to have an implicit AND.

Type

str

force

Optional. The default value is false. Override this flag to true to actually perform the purge. If the field is not set to true, a sampling of events to be deleted will be returned.

Type

bool

class google.cloud.recommendationengine_v1beta1.types.PurgeUserEventsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response of the PurgeUserEventsRequest. If the long running operation is successfully done, then this message is returned by the google.longrunning.Operations.response field.

purged_events_count

The total count of events purged as a result of the operation.

Type

int

user_events_sample

A sampling of events deleted (or will be deleted) depending on the force property in the request. Max of 500 items will be returned.

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.UserEvent]

class google.cloud.recommendationengine_v1beta1.types.UpdateCatalogItemRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for UpdateCatalogItem method.

name

Required. Full resource name of catalog item, such as projects/*/locations/global/catalogs/default_catalog/catalogItems/some_catalog_item_id.

Type

str

catalog_item

Required. The catalog item to update/create. The ‘catalog_item_id’ field has to match that in the ‘name’.

Type

google.cloud.recommendationengine_v1beta1.types.CatalogItem

update_mask

Optional. Indicates which fields in the provided ‘item’ to update. If not set, will by default update all fields.

Type

google.protobuf.field_mask_pb2.FieldMask

class google.cloud.recommendationengine_v1beta1.types.UserEvent(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

UserEvent captures all metadata information recommendation engine needs to know about how end users interact with customers’ website.

event_type

Required. User event type. Allowed values are:

  • add-to-cart Products being added to cart.

  • add-to-list Items being added to a list (shopping list, favorites etc).

  • category-page-view Special pages such as sale or promotion pages viewed.

  • checkout-start User starting a checkout process.

  • detail-page-view Products detail page viewed.

  • home-page-view Homepage viewed.

  • page-visit Generic page visits not included in the event types above.

  • purchase-complete User finishing a purchase.

  • refund Purchased items being refunded or returned.

  • remove-from-cart Products being removed from cart.

  • remove-from-list Items being removed from a list.

  • search Product search.

  • shopping-cart-page-view User viewing a shopping cart.

  • impression List of items displayed. Used by Google Tag Manager.

Type

str

user_info

Required. User information.

Type

google.cloud.recommendationengine_v1beta1.types.UserInfo

event_detail

Optional. User event detailed information common across different recommendation types.

Type

google.cloud.recommendationengine_v1beta1.types.EventDetail

product_event_detail

Optional. Retail product specific user event metadata.

This field is required for the following event types:

  • add-to-cart

  • add-to-list

  • category-page-view

  • checkout-start

  • detail-page-view

  • purchase-complete

  • refund

  • remove-from-cart

  • remove-from-list

  • search

This field is optional for the following event types:

  • page-visit

  • shopping-cart-page-view - note that ‘product_event_detail’ should be set for this unless the shopping cart is empty.

This field is not allowed for the following event types:

  • home-page-view

Type

google.cloud.recommendationengine_v1beta1.types.ProductEventDetail

event_time

Optional. Only required for ImportUserEvents method. Timestamp of user event created.

Type

google.protobuf.timestamp_pb2.Timestamp

event_source

Optional. This field should not be set when using JavaScript pixel or the Recommendations AI Tag. Defaults to EVENT_SOURCE_UNSPECIFIED.

Type

google.cloud.recommendationengine_v1beta1.types.UserEvent.EventSource

class EventSource(value)[source]

Bases: proto.enums.Enum

User event source.

Values:
EVENT_SOURCE_UNSPECIFIED (0):

Unspecified event source.

AUTOML (1):

The event is ingested via a javascript pixel or Recommendations AI Tag through automl datalayer or JS Macros.

ECOMMERCE (2):

The event is ingested via Recommendations AI Tag through Enhanced Ecommerce datalayer.

BATCH_UPLOAD (3):

The event is ingested via Import user events API.

class google.cloud.recommendationengine_v1beta1.types.UserEventImportSummary(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A summary of import result. The UserEventImportSummary summarizes the import status for user events.

joined_events_count

Count of user events imported with complete existing catalog information.

Type

int

unjoined_events_count

Count of user events imported, but with catalog information not found in the imported catalog.

Type

int

class google.cloud.recommendationengine_v1beta1.types.UserEventInlineSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The inline source for the input config for ImportUserEvents method.

user_events

Optional. A list of user events to import. Recommended max of 10k items.

Type

MutableSequence[google.cloud.recommendationengine_v1beta1.types.UserEvent]

class google.cloud.recommendationengine_v1beta1.types.UserInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Information of end users.

visitor_id

Required. A unique identifier for tracking visitors with a length limit of 128 bytes.

For example, this could be implemented with a http cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor log in/out of the website. Maximum length 128 bytes. Cannot be empty.

Type

str

user_id

Optional. Unique identifier for logged-in user with a length limit of 128 bytes. Required only for logged-in users.

Type

str

ip_address

Optional. IP address of the user. This could be either IPv4 (e.g. 104.133.9.80) or IPv6 (e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334). This should not be set when using the javascript pixel or if direct_user_request is set. Used to extract location information for personalization.

Type

str

user_agent

Optional. User agent as included in the HTTP header. UTF-8 encoded string with a length limit of 1 KiB.

This should not be set when using the JavaScript pixel or if directUserRequest is set.

Type

str

direct_user_request

Optional. Indicates if the request is made directly from the end user in which case the user_agent and ip_address fields can be populated from the HTTP request. This should not be set when using the javascript pixel. This flag should be set only if the API request is made directly from the end user such as a mobile app (and not if a gateway or a server is processing and pushing the user events).

Type

bool

class google.cloud.recommendationengine_v1beta1.types.WriteUserEventRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for WriteUserEvent method.

parent

Required. The parent eventStore resource name, such as projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store.

Type

str

user_event

Required. User event to write.

Type

google.cloud.recommendationengine_v1beta1.types.UserEvent