Get started with generic recommendations

You can quickly build a state-of-the-art generic recommendations app on your own data that can suggest content similar to the content that the user is currently viewing.

This tutorial explains how to create three generic recommendations apps, each for a different kind of data:

  • Unstructured data in the form of PDFs ingested from a Cloud Storage bucket
  • Structured data in the form of NDJSON ingested from a Cloud Storage bucket
  • Website data from URLs that you provide

Before following this tutorial, make sure you have done the steps in Before you begin.


To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:

Guide me


Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Vertex AI Agent Builder, Cloud Storage APIs.

    Enable the APIs

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Vertex AI Agent Builder, Cloud Storage APIs.

    Enable the APIs

Activate Vertex AI Agent Builder

  1. In the Google Cloud console, go to the Agent Builder page.

    Agent Builder

  2. Read and agree to the Terms of Service, then click Continue and activate the API.

Create, preview, and deploy an app for unstructured data

The procedures in this section guide you through creating and deploying a recommendations app for unstructured data.

Create an app for unstructured data

  1. In the Google Cloud console, go to the Agent Builder page.

    Agent Builder

  2. Click New app.

  3. On the Create app page, select Recommendations.

  4. In the App name field, enter a name for your app. Your app ID appears under the app name.

  5. Under Content, make sure Generic is selected.

  6. Click Continue.

  7. On the Data stores page, click Create new data store.

  8. On the Select a data source page, select Cloud Storage.

  9. On the Import data from Cloud Storage page, make sure Folder is selected.

  10. In the gs:// field, enter the following value:

    cloud-samples-data/gen-app-builder/search/alphabet-investor-pdfs
    

    This Cloud Storage bucket contains earnings report PDFs from the Alphabet investor site.

  11. Select Unstructured documents, and then click Continue.

  12. Enter a name for your data store, and then click Create.

  13. Select the data store you just created, and then click Create to create your app.

  14. On your data store's Data page, go to the Activity tab to see the status of your data ingestion. Import completed displays in the Status column when the import process is complete. For this dataset, this typically takes two to three minutes. You might need to click Refresh to see Import completed.

  15. Click the Documents tab to see the imported documents.

Preview your app with unstructured data

  1. In the navigation menu, click Preview.

  2. Click the Document ID field. A list of document IDs appears.

  3. Click the document ID for the document that you want recommendations for. Alternatively, enter a document ID into the Document ID field.

  4. Click Get recommendations. A list of recommended documents appears.

  5. Click a document to get document details.

Test your app for unstructured data

There is no recommendations widget for deploying your app. To test your app before deployment:

  1. Go to the Data page and copy a document ID.

  2. Go to the Integration page. This page includes a sample command for the servingConfigs.recommend method in the REST API.

  3. Paste the document ID you copied earlier into the Document ID field.

  4. Leave the User Pseudo ID field as is.

  5. Copy the example request and run it in Cloud Shell.

For help integrating the recommendations app into your web app, see the code samples for C#, Go, Java, Node.js, PHP, and Ruby at Get recommendations for an app with unstructured data.

Create, preview, and deploy an app for structured data

The procedures in this section guide you through creating and deploying a recommendations app for structured data.

Create an app for structured data

  1. In the Google Cloud console, go to the Agent Builder page.

    Agent Builder

  2. Click New app.

  3. On the Create app page, select Recommendations.

  4. In the App name field, enter a name for your app. Your app ID appears under the app name.

  5. Under Content, make sure Generic is selected.

  6. Click Continue.

  7. On the Data stores page, click Create new data store.

  8. On the Select a data source page, select Cloud Storage.

  9. On the Import data from Cloud Storage page, make sure Folder is selected.

  10. In the gs:// field, enter the following value:

    cloud-samples-data/gen-app-builder/search/kaggle_movies
    

    This Cloud Storage bucket contains an NDJSON-formatted dataset of movies made available by Kaggle.

  11. Select JSON for structured data, and then click Continue.

  12. Enter a display name for your data store, and then click Create.

  13. Select the data store you just created, and then click Create to create your app.

  14. On the Data page, go to the Activity tab to see the status of your data ingestion. Import completed displays in the Status column when the import process is complete. For this dataset, this typically takes two to three minutes. You might need to click Refresh to see Import completed.

  15. Click the Documents tab to see the imported documents.

Preview your app for structured data

  1. In the navigation menu, click Preview.

  2. Click the Document ID field. A list of document IDs appears.

  3. Click the document ID for the document that you want recommendations for. Alternatively, enter a document ID into the Document ID field.

  4. Click Get recommendations. A list of recommended documents appears.

  5. Click a document to get document details.

Test your app for structured data

There is no recommendations widget for deploying your app. To test your app before deployment:

  1. Go to the Data page and copy a document ID.

  2. Go to the Integration page. This page includes a sample command for the servingConfigs.recommend method in the REST API.

  3. Paste the document ID you copied earlier into the Document ID field.

  4. Leave the User Pseudo ID field as is.

  5. Copy the example request and run it in Cloud Shell.

For help integrating the recommendations app into your web app, see the code samples for C#, Go, Java, Node.js, PHP, and Ruby at Get recommendations for an app with structured data.

(Optional) Create, preview, and deploy an app with website data

The procedures in this section guide you through creating and deploying a recommendations app based on data from a website.

Create a recommendations app for website data

  1. In the Google Cloud console, go to the Agent Builder page.

    Agent Builder

  2. Click New app.

  3. On the Create App page, select Recommendations.

  4. In the App name field, enter a name for your app. Your app ID appears under the app name.

  5. Under Content, make sure Generic is selected.

  6. Click Continue.

  7. On the Data stores page, click Create new data store.

  8. On the Select a data source page, select Website URLs.

  9. On the Specify the websites for your data store page, enter the URLs of the websites that you want to include in your recommendations app. Include one URL per line, without comma separators.

  10. Click Continue.

  11. On the Configure your data store page, enter a display name for your data store, and then click Create.

  12. On the Data stores page, select your new data store, and then click Create to create your app.

  13. On the Data page, go to the Activity tab to see the status of your data ingestion. Import completed displays in the Status column when the import process is complete. You might need to click Refresh to see Import completed.

  14. Click the Documents tab to see the imported documents.

Preview your app for website data

  1. In the navigation menu, click Preview to test the app.

  2. Click the URI field. A list of URLs from your website appears.

  3. Click the URL for the web page that you want recommendations for. Alternatively, enter a URL from your website into the URL field.

  4. Click Get recommendations. A list of URLs for recommended web pages appears.

  5. Click a URL to view the web page.

Test your app for website data

There is no recommendations widget for deploying your app. To test your app before deployment:

  1. Go to the Data page and copy a document ID.

  2. Go to the Integration page. This page includes a sample command for the servingConfigs.recommend method in the REST API.

  3. Paste the document ID you copied earlier into the Document ID field.

  4. Leave the User Pseudo ID field as is.

  5. Copy the example request and run it in Cloud Shell.

For help integrating the recommendations app into your web app, see the code samples for C#, Go, Java, Node.js, PHP, and Ruby at Get recommendations for an app with website data.

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

  1. To avoid unnecessary Google Cloud charges, use the Google Cloud console to delete your project if you do not need it.
  2. If you created a new project to learn about Vertex AI Agent Builder and you no longer need the project, delete the project.
  3. If you used an existing Google Cloud project, delete the resources you created to avoid incurring charges to your account. For more information, see Delete an app.
  4. Follow the steps in Turn off Vertex AI Agent Builder.

What's next