# Get started with custom recommendations

> [!NOTE]
> **Note:** This feature is a Preview offering, subject to the "Pre-GA Offerings Terms" of the [GCP Service Specific Terms](https://cloud.google.com/terms/service-terms). Pre-GA products and features may have limited support, and changes to pre-GA products and features may not be compatible with other pre-GA versions. For more information, see the [launch stage descriptions](https://cloud.google.com/products#product-launch-stages). Further, by using this feature, you agree to the [Generative AI Preview terms and conditions](https://cloud.google.com/trustedtester/aitos) ("Preview Terms"). For this feature, you can process personal data as outlined in the [Cloud Data Processing Addendum](https://cloud.google.com/terms/data-processing-addendum), subject to applicable restrictions and obligations in the Agreement (as defined in the Preview Terms).
>
> <br />
>
You can quickly build a state-of-the-art custom 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 a custom recommendations app for
structured data. In this case, the structured data is in the form of NDJSON
ingested from a Cloud Storage bucket.

Before following this tutorial, make sure you have done the steps in [Before you
begin](https://docs.cloud.google.com/generative-ai-app-builder/docs/before-you-begin).

*** ** * ** ***

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

[Guide me](https://console.cloud.google.com/gen-app-builder/?tutorial=generative-ai-app-builder--genappbuilder-recommendations-intro)

*** ** * ** ***

## Before you begin

<br />

## Enable Agent Search

1. In the Google Cloud console, go to the **AI Applications** page.

   [AI Applications](https://console.cloud.google.com/gen-app-builder/start)
2. Optional: Click **Allow Google to selectively sample model input and
   responses**.

3. Click **Continue and activate the API**.

## Create a data store

This procedure guides you through creating a data store and uploading sample
data provided.

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](https://www.kaggle.com/datasets/rounakbanik/the-movies-dataset?select=movies_metadata.csv).
7. Click **Continue**.

8. Assign key properties as follows:

   | Field name | Key property |
   |---|---|
   | `homepage` | `uri` |
   | `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.

## Create an app

Next, you 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, under **Recommendations engine** , click **Create**.

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

5. Click **Continue**.

6. In the list of data stores, select the data store that you created earlier.

7. Click **Create**.

### Preview your app

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.

### 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`](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.servingConfigs/recommend.md.txt) 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](https://docs.cloud.google.com/generative-ai-app-builder/docs/preview-recommendations.md.txt).

## 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](https://console.cloud.google.com/) to delete your project if you don't need it.
2. If you created a new project to learn about Agent Search and you no longer need the project, [delete the project](https://console.cloud.google.com/cloud-resource-manager).
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](https://docs.cloud.google.com/generative-ai-app-builder/docs/delete-engine.md.txt).
4. Follow the steps in [Turn off
   Agent Search](https://docs.cloud.google.com/generative-ai-app-builder/docs/turn-off-enterprise-search).

## What's next

- [Introduction to Agent Search](https://docs.cloud.google.com/generative-ai-app-builder/docs/enterprise-search-introduction)
- [About apps and data stores](https://docs.cloud.google.com/generative-ai-app-builder/docs/create-datastore-ingest.md.txt)