Skip to content

GCP.RecommendationEngine reference

Source: src/GCP/RecommendationEngine/CatalogsCatalogItem.ts

A Recommendations AI catalog item.

Catalog items have no labels field. Their description and tags feed recommendations, so Alchemy writes no ownership marker into them: a generated item id identifies the item, and read reports an explicit id it has no state for as unowned. Catalog, location, and item id are immutable. Title, description, categories, tags, and product metadata update in place.

CatalogsCatalogItem: Creating a Catalog Item

Section titled “CatalogsCatalogItem: Creating a Catalog Item”

Item on the default catalog

const item = yield* GCP.RecommendationEngine.CatalogsCatalogItem("Shirt", {
title: "Cotton tee",
categoryHierarchies: [{ categories: ["Apparel", "T-Shirts"] }],
productMetadata: {
currencyCode: "USD",
exactPrice: { displayPrice: 20 },
stockState: "IN_STOCK",
},
});

Explicit catalog and item id

const item = yield* GCP.RecommendationEngine.CatalogsCatalogItem("Shirt", {
catalog: "default_catalog",
location: "global",
catalogItemId: "cotton-tee",
title: "Cotton tee",
description: "Soft cotton t-shirt",
});

CatalogsCatalogItem: Updating a Catalog Item

Section titled “CatalogsCatalogItem: Updating a Catalog Item”
const item = yield* GCP.RecommendationEngine.CatalogsCatalogItem("Shirt", {
title: "Linen tee",
categoryHierarchies: [{ categories: ["Apparel", "T-Shirts"] }],
productMetadata: {
currencyCode: "USD",
exactPrice: { displayPrice: 24 },
},
});

Source: src/GCP/RecommendationEngine/GetCatalogItem.ts

Runtime binding for Recommendations AI catalogItems.get.

Bind this operation to a CatalogsCatalogItem in a Function or Action init phase. Provide GetCatalogItemHttp.

Grants roles/automlrecommendations.viewer on the project: Recommendations AI has no resource-level IAM.

const getCatalogItem = yield* GCP.RecommendationEngine.GetCatalogItem(item);
const live = yield* getCatalogItem();

Source: src/GCP/RecommendationEngine/GetCatalogItemHttp.ts Kind: Layer · Provides: GCP.RecommendationEngine.GetCatalogItem

HTTP implementation of GetCatalogItem.