apache_beam.ml.gcp.recommendations_ai module¶
A connector for sending API requests to the GCP Recommendations AI API (https://cloud.google.com/recommendations).
- class apache_beam.ml.gcp.recommendations_ai.CreateCatalogItem(project: str | None = None, retry: Retry | None = None, timeout: float = 120, metadata: Sequence[Tuple[str, str]] = (), catalog_name: str = 'default_catalog')[source]¶
Bases:
PTransform
Creates catalogitem information. The
PTransform
returns a PCollectionTuple with a PCollections of successfully and failed created CatalogItems.Example usage:
pipeline | CreateCatalogItem( project='example-gcp-project', catalog_name='my-catalog')
Initializes a
CreateCatalogItem
transform.- Parameters:
project (str) – Optional. GCP project name in which the catalog data will be imported.
retry – Optional. Designation of what errors, if any, should be retried.
timeout (float) – Optional. The amount of time, in seconds, to wait for the request to complete.
metadata – Optional. Strings which should be sent along with the request as metadata.
catalog_name (str) – Optional. Name of the catalog. Default: ‘default_catalog’
- class apache_beam.ml.gcp.recommendations_ai.WriteUserEvent(project: str | None = None, retry: Retry | None = None, timeout: float = 120, metadata: Sequence[Tuple[str, str]] = (), catalog_name: str = 'default_catalog', event_store: str = 'default_event_store')[source]¶
Bases:
PTransform
Write user event information. The PTransform returns a PCollectionTuple with PCollections of successfully and failed written UserEvents.
Example usage:
pipeline | WriteUserEvent( project='example-gcp-project', catalog_name='my-catalog', event_store='my_event_store')
Initializes a
WriteUserEvent
transform.- Parameters:
project (str) – Optional. GCP project name in which the catalog data will be imported.
retry – Optional. Designation of what errors, if any, should be retried.
timeout (float) – Optional. The amount of time, in seconds, to wait for the request to complete.
metadata – Optional. Strings which should be sent along with the request as metadata.
catalog_name (str) – Optional. Name of the catalog. Default: ‘default_catalog’
event_store (str) – Optional. Name of the event store. Default: ‘default_event_store’
- class apache_beam.ml.gcp.recommendations_ai.ImportCatalogItems(max_batch_size: int = 5000, project: str | None = None, retry: Retry | None = None, timeout: float = 120, metadata: Sequence[Tuple[str, str]] = (), catalog_name: str = 'default_catalog')[source]¶
Bases:
PTransform
Imports catalogitems in bulk. The PTransform returns a PCollectionTuple with PCollections of successfully and failed imported CatalogItems.
Example usage:
pipeline | ImportCatalogItems( project='example-gcp-project', catalog_name='my-catalog')
Initializes a
ImportCatalogItems
transform- Parameters:
batch_size (int) – Required. Maximum number of catalogitems per request.
project (str) – Optional. GCP project name in which the catalog data will be imported.
retry – Optional. Designation of what errors, if any, should be retried.
timeout (float) – Optional. The amount of time, in seconds, to wait for the request to complete.
metadata – Optional. Strings which should be sent along with the request as metadata.
catalog_name (str) – Optional. Name of the catalog. Default: ‘default_catalog’
- class apache_beam.ml.gcp.recommendations_ai.ImportUserEvents(max_batch_size: int = 5000, project: str | None = None, retry: Retry | None = None, timeout: float = 120, metadata: Sequence[Tuple[str, str]] = (), catalog_name: str = 'default_catalog', event_store: str = 'default_event_store')[source]¶
Bases:
PTransform
Imports userevents in bulk. The PTransform returns a PCollectionTuple with PCollections of successfully and failed imported UserEvents.
Example usage:
pipeline | ImportUserEvents( project='example-gcp-project', catalog_name='my-catalog', event_store='my_event_store')
Initializes a
WriteUserEvent
transform.- Parameters:
batch_size (int) – Required. Maximum number of catalogitems per request.
project (str) – Optional. GCP project name in which the catalog data will be imported.
retry – Optional. Designation of what errors, if any, should be retried.
timeout (float) – Optional. The amount of time, in seconds, to wait for the request to complete.
metadata – Optional. Strings which should be sent along with the request as metadata.
catalog_name (str) – Optional. Name of the catalog. Default: ‘default_catalog’
event_store (str) – Optional. Name of the event store. Default: ‘default_event_store’
- class apache_beam.ml.gcp.recommendations_ai.PredictUserEvent(project: str | None = None, retry: Retry | None = None, timeout: float = 120, metadata: Sequence[Tuple[str, str]] = (), catalog_name: str = 'default_catalog', event_store: str = 'default_event_store', placement_id: str | None = None)[source]¶
Bases:
PTransform
Make a recommendation prediction. The PTransform returns a PCollection
Example usage:
pipeline | PredictUserEvent( project='example-gcp-project', catalog_name='my-catalog', event_store='my_event_store', placement_id='recently_viewed_default')
Initializes a
PredictUserEvent
transform.- Parameters:
project (str) – Optional. GCP project name in which the catalog data will be imported.
retry – Optional. Designation of what errors, if any, should be retried.
timeout (float) – Optional. The amount of time, in seconds, to wait for the request to complete.
metadata – Optional. Strings which should be sent along with the request as metadata.
catalog_name (str) – Optional. Name of the catalog. Default: ‘default_catalog’
event_store (str) – Optional. Name of the event store. Default: ‘default_event_store’
placement_id (str) – Required. ID of the recommendation engine placement. This id is used to identify the set of models that will be used to make the prediction.