כשמשלבים את AlloyDB ל-PostgreSQL עם Gemini Enterprise Agent Platform, אפשר להריץ שאילתות SQL שמעבירות את הנתונים ממסד הנתונים ישירות למודלים של Agent Platform כדי ליצור הטמעות וחיזויים אונליין.
ההוראות האלה ספציפיות לשימוש ב-AlloyDB, ולא ב-AlloyDB Omni. כדי לשלב התקנה מקומית של AlloyDB Omni באמצעות Agent Platform, קראו את המאמר התקנת AlloyDB Omni עם AlloyDB AI.
מידע נוסף על שימוש במודלים של למידת מכונה עם AlloyDB זמין במאמר פיתוח אפליקציות של AI גנרטיבי באמצעות AlloyDB AI.
למידע נוסף על Agent Platform, קראו את הסקירה הכללית של Agent Platform.
לפני שמתחילים
- נכנסים לחשבון 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 Platform API, if it is not already enabled.
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.-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init -
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 Platform API, if it is not already enabled.
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.-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
מידע על סוכן השירות של AlloyDB
כשמשתמשים ב-AlloyDB עם שירותים אחרים של Google Cloud , AlloyDB משתמש בסוכן שירות של ניהול זהויות והרשאות גישה (IAM) כדי לאמת את השירותים האלה. סוכן השירות הזה הוא חשבון משתמש ב-IAM שנשלט על ידי AlloyDB. כדי לאפשר לסוכן השירות לגשת לשירותים אחרים של Google Cloud בשמכם, אתם צריכים להקצות לו תפקידים ב-IAM.
מקצים את התפקיד Vertex AI User לסוכן השירות של AlloyDB
כדי לאפשר שילוב של מסד הנתונים עם פלטפורמת הסוכנים, אתם צריכים לתת לסוכן השירות של AlloyDB את התפקיד Vertex AI User. כך סוכן השירות של AlloyDB יכול לגשת ל-Agent Platform בשמכם.
כדי להקצות לסוכן השירות של AlloyDB את התפקיד Vertex AI User:
מוסיפים את ההרשאות של Agent Platform לסוכן השירות של AlloyDB בפרויקט שבו נמצא האשכול של מסד הנתונים של AlloyDB:
המסוף
נכנסים לדף Welcome במסוף Google Cloud ומעתיקים את מספר הפרויקט של הפרויקט שיש בו אשכולות או מכונות של AlloyDB. תצטרכו להשתמש במספר הפרויקט הזה בשלבים הבאים.
נכנסים לדף IAM במסוף Google Cloud .
בוחרים את הפרויקט שצריך לקרוא לנקודות הקצה של Agent Platform.
מפעילים את האפשרות Include Google-provided role grants.
לוחצים על Grant Access.
בשדה New principals, מזינים את הפרטים הבאים:
service-PROJECT_NUMBER@gcp-sa-alloydb.iam.gserviceaccount.comמחליפים את
PROJECT_NUMBERבמספר הפרויקט.בשדה Role, מזינים Vertex AI User.
לוחצים על Save.
gcloud
כדי להשתמש ב-CLI של gcloud, אתם יכולים להתקין ולהפעיל את Google Cloud CLI או להשתמש ב-Cloud Shell.
gcloud projects add-iam-policy-binding PROJECT_ID
--member="serviceAccount:service-PROJECT_NUMBER@gcp-sa-alloydb.iam.gserviceaccount.com"
--role="roles/aiplatform.user"
מחליפים את מה שכתוב בשדות הבאים:
-
PROJECT_ID: מזהה הפרויקט עם נקודת הקצה של Agent Platform. -
PROJECT_NUMBER: מספר הפרויקט שבו נמצאים האשכולות או המכונות של AlloyDB.
אימות התוסף המותקן
בודקים אם google_ml_integration מותקן במסד הנתונים שמכיל את הנתונים שרוצים להריץ עליהם חיזויים:
המסוף
נכנסים לדף Clusters במסוף Google Cloud .
כדי להציג את הדף Overview של האשכול, לוחצים על השם של אשכול AlloyDB בעמודה Resource name.
בתפריט הניווט, לוחצים על AlloyDB Studio.
בדף Sign in to AlloyDB Studio, מאמתים באמצעות שם מסד הנתונים, שם המשתמש והסיסמה.
בכרטיסייה עורך 1, מבצעים את הפעולות הבאות:
מוודאים שמותקנת גרסה 1.4.2 או גרסה חדשה יותר של התוסף
google_ml_integration:SELECT extversion FROM pg_extension WHERE extname = 'google_ml_integration';
לוחצים על Run. מחכים עד שגרסת התוסף תוצג בחלונית Results.
psql
מחברים לקוח
psqlלמכונה הראשית של האשכול, כמו שמתואר במאמר חיבור לקוחpsqlלמכונה.בשורת הפקודה של
psql, מתחברים למסד הנתונים:\c DB_NAME
מחליפים את
DB_NAMEבשם של מסד הנתונים שבו רוצים להתקין את התוסף.מוודאים שמותקנת גרסה 1.4.2 או גרסה חדשה יותר של התוסף
google_ml_integration:SELECT extversion FROM pg_extension WHERE extname = 'google_ml_integration';