איך מתחילים להשתמש בהמלצות בהתאמה אישית
אתם יכולים ליצור במהירות אפליקציה מתקדמת של המלצות מותאמות אישית על סמך הנתונים שלכם, שתציע תוכן דומה לתוכן שהמשתמש צופה בו כרגע.
במדריך הזה מוסבר איך ליצור אפליקציה מותאמת אישית להמלצות לנתונים מובנים. במקרה הזה, הנתונים המובְנים הם בפורמט NDJSON שנבלעו מקטגוריה של Cloud Storage.
לפני שממשיכים במדריך הזה, חשוב לוודא שביצעתם את השלבים שבקטע לפני שמתחילים.
לחצו על תראו לי איך כדי לקרוא הסבר מפורט על המשימה ישירות במסוף Google Cloud :
לפני שמתחילים
- נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Search (Discovery Engine), Cloud Storage APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Discovery Engine Admin, Monitoring Viewer, and Service Usage Viewer.
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Agent Search (Discovery Engine), Cloud Storage APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Discovery Engine Admin, Monitoring Viewer, and Service Usage Viewer.
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
הפעלת חיפוש באמצעות סוכן
נכנסים לדף AI Applications במסוף Google Cloud .
אופציונלי: לוחצים על אני רוצה לאפשר ל-Google לבצע דגימה סלקטיבית של קלט ותגובות של המודל.
לוחצים על המשך והפעלת ה-API.
יצירת מאגר נתונים
במאמר הזה מוסבר איך ליצור מאגר נתונים ולהעלות נתונים לדוגמה שסופקו.
עוברים לדף
מאגרי נתונים .לוחצים על
יצירת מאגר נתונים .בדף Select a data source (בחירת מקור נתונים), בוחרים באפשרות Cloud Storage.
בדף ייבוא נתונים מ-Cloud Storage, בוחרים באפשרות נתונים מובנים (JSONL).
לוחצים על קובץ.
בשדה gs://, מזינים את הערך הבא:
cloud-samples-data/gen-app-builder/search/kaggle_movies/movie_metadata.ndjson
קטגוריה של Cloud Storage זו מכילה קובץ בפורמט NDJSON של סרטים שזמינים דרך Kaggle.
לוחצים על Continue.
מקצים את מאפייני המפתח באופן הבא:
שם השדה נכס מרכזי homepageurioverviewdescriptionלוחצים על המשך.
מזינים שם לתצוגה של מאגר הנתונים ולוחצים על יצירה.
לוחצים על השם של מאגר הנתונים.
בדף נתונים, עוברים לכרטיסייה פעילות כדי לראות את הסטטוס של הטמעת הנתונים. ההודעה פעולת הייבוא הושלמה מוצגת בעמודה סטטוס כשתהליך הייבוא מסתיים. במערך הנתונים הזה, התהליך בדרך כלל נמשך שתיים עד שלוש דקות. יכול להיות שתצטרכו ללחוץ על רענון כדי לראות את ההודעה הייבוא הושלם.
לוחצים על הכרטיסייה מסמכים כדי לראות את המסמכים המיובאים.
יצירת אפליקציה
בשלב הבא, יוצרים אפליקציה להמלצות ומקשרים את מאגר הנתונים שיצרתם קודם.
עוברים לדף
אפליקציות .לוחצים על
יצירת אפליקציה .בדף Create App (יצירת אפליקציה), בקטע Recommendations engine (מנוע המלצות), לוחצים על Create (יצירה).
בשדה שם האפליקציה, מזינים שם לאפליקציה. מזהה האפליקציה מופיע מתחת לשם האפליקציה.
לוחצים על Continue.
ברשימת מאגרי הנתונים, בוחרים את מאגר הנתונים שיצרתם קודם.
לוחצים על יצירה.
תצוגה מקדימה של האפליקציה
בתפריט הניווט, לוחצים על
תצוגה מקדימה כדי לבדוק את האפליקציה.אם מוצגת ההודעה 'כאן תוכלו לראות תצוגה מקדימה של מנוע ההמלצות. אנחנו עדיין מכינים את המנוע, כדאי לחזור לכאן מאוחר יותר', צריך להמתין ולרענן את הדף מדי פעם. יכול להיות שתצטרכו לחכות כמה שעות או עד למחרת כדי לראות תצוגה מקדימה של הנתונים.
לוחצים על השדה מזהה מסמך. תוצג רשימה של מזהי מסמכים.
לוחצים על מזהה המסמך של המסמך שרוצים לקבל לגביו המלצות. אפשרות אחרת היא להזין מזהה מסמך בשדה מזהה המסמך.
לוחצים על קבלת המלצות. תוצג רשימה של מסמכים מומלצים.
כדי לראות את פרטי המסמך, לוחצים על המסמך.
פריסת האפליקציה
אין ווידג'ט של המלצות לפריסת האפליקציה. כדי לבדוק את האפליקציה לפני הפריסה:
עוברים לדף נתונים ומעתיקים מזהה של מסמך.
עוברים לדף שילוב. בדף הזה יש פקודה לדוגמה לשימוש בשיטה
servingConfigs.recommendב-API בארכיטקטורת REST.מדביקים את מזהה המסמך שהעתקתם קודם בשדה מזהה המסמך.
משאירים את השדה User Pseudo ID כמו שהוא.
מעתיקים את הבקשה לדוגמה ומפעילים פתרונות חכמים ב-Cloud Shell.
התוצאות הן מזהי המסמכים שמומלצים על סמך המסמך שבחרתם.
כדי לקבל עזרה בשילוב אפליקציית ההמלצות באפליקציית האינטרנט, אפשר לעיין בדוגמאות הקוד בשפות C#, Go, Java, Node.js, PHP ו-Ruby במאמר קבלת המלצות לאפליקציה.
הסרת המשאבים
כדי לא לצבור חיובים לחשבון Google Cloud על המשאבים שבהם השתמשתם בדף הזה, פועלים לפי השלבים הבאים:
- כדי להימנע מחיובים מיותרים Google Cloud , כדאי להשתמש בGoogle Cloud console כדי למחוק את הפרויקט אם הוא לא נחוץ לכם.
- אם יצרתם פרויקט חדש כדי ללמוד על חיפוש מבוסס סוכנים ואתם כבר לא צריכים את הפרויקט, אפשר למחוק אותו.
- אם השתמשתם בפרויקט קיים Google Cloud , מחקו את המשאבים שיצרתם כדי להימנע מחיובים בחשבון. מידע נוסף זמין במאמר מחיקת אפליקציה.
- פועלים לפי השלבים שמפורטים במאמר השבתה של חיפוש מבוסס סוכנים.