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

Enable 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, and then click Continue and activate the API.

Create a data store

This procedure guides you through creating a data store and uploading sample data provided. Click the tab for the type of data store you want to create.

Website data

  1. Go to the Data Stores page.

  2. Click Create data store.

  3. On the Select a data source page, select Website Content.

  4. 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.

  5. Click Continue.

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

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

  8. 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.

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

Structured data

  1. Go to the Data Stores page.

  2. Click Create data store.

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

  4. On the Import data from Cloud Storage page, select Structured data (JSONL).

  5. Click File.

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

    cloud-samples-data/gen-app-builder/search/kaggle_movies/movie_metadata.ndjson
    

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

  7. Click Continue.

  8. Assign key properties as follows:

    Field name Key property
    homepage uri
    original_title title
    overview description

    And, click Continue.

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

  10. Click the name of your data store.

  11. 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.

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

Unstructured data

  1. Go to the Data Stores page.

  2. Click Create data store.

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

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

  5. 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.

  6. Select Unstructured documents, and then click Continue.

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

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

  9. 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.

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

Create an app

Next, you will create a recommendations app and link the data store you created previously.

  1. Go to the Apps page.

  2. Click Create 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. In the list of data stores, select the data store that you created earlier.

  8. Click Create.

Preview your app

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.

Structured data

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

  2. If you see the message "You will be able to preview your recommendation engine here We are still preparing your engine, please check back later", wait and periodically refresh the page. You might have to wait some hours or until the next day to preview your data.

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

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

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

  6. Click a document to get document details.

Unstructured data

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

  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.

Deploy your app

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.

    The results are the IDs of documents recommended based on the document that you chose.

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.

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 don't 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