שילוב עם Agent Platform

כשמשלבים את 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.

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אנחנו ממליצים למשתמשים חדשים ב- Google Cloud ליצור חשבון כדי שיוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Agent Platform API, if it is not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. 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.

    Enable the API

  5. Install the Google Cloud CLI.

  6. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  7. To initialize the gcloud CLI, run the following command:

    gcloud init
  8. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  9. Verify that billing is enabled for your Google Cloud project.

  10. Enable the Agent Platform API, if it is not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. 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.

    Enable the API

  11. Install the Google Cloud CLI.

  12. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  13. 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:

המסוף

  1. נכנסים לדף Welcome במסוף Google Cloud ומעתיקים את מספר הפרויקט של הפרויקט שיש בו אשכולות או מכונות של AlloyDB. תצטרכו להשתמש במספר הפרויקט הזה בשלבים הבאים.

    לדף Welcome

  2. נכנסים לדף IAM במסוף Google Cloud .

    כניסה לדף IAM

  3. בוחרים את הפרויקט שצריך לקרוא לנקודות הקצה של Agent Platform.

  4. מפעילים את האפשרות Include Google-provided role grants.

  5. לוחצים על Grant Access.

  6. בשדה New principals, מזינים את הפרטים הבאים:

        service-PROJECT_NUMBER@gcp-sa-alloydb.iam.gserviceaccount.com
        

    מחליפים את PROJECT_NUMBER במספר הפרויקט.

  7. בשדה Role, מזינים Vertex AI User.

  8. לוחצים על 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 מותקן במסד הנתונים שמכיל את הנתונים שרוצים להריץ עליהם חיזויים:

המסוף

  1. נכנסים לדף Clusters במסוף Google Cloud .

    כניסה לדף Clusters

  2. כדי להציג את הדף Overview של האשכול, לוחצים על השם של אשכול AlloyDB בעמודה Resource name.

  3. בתפריט הניווט, לוחצים על AlloyDB Studio.

  4. בדף Sign in to AlloyDB Studio, מאמתים באמצעות שם מסד הנתונים, שם המשתמש והסיסמה.

  5. בכרטיסייה עורך 1, מבצעים את הפעולות הבאות:

    1. מוודאים שמותקנת גרסה 1.4.2 או גרסה חדשה יותר של התוסף google_ml_integration:

      SELECT extversion FROM pg_extension WHERE extname = 'google_ml_integration';
    2. לוחצים על Run. מחכים עד שגרסת התוסף תוצג בחלונית Results.

psql

  1. מחברים לקוח psql למכונה הראשית של האשכול, כמו שמתואר במאמר חיבור לקוח psql למכונה.

  2. בשורת הפקודה של psql, מתחברים למסד הנתונים:

    \c DB_NAME

    מחליפים את DB_NAME בשם של מסד הנתונים שבו רוצים להתקין את התוסף.

  3. מוודאים שמותקנת גרסה 1.4.2 או גרסה חדשה יותר של התוסף google_ml_integration:

    SELECT extversion FROM pg_extension WHERE extname = 'google_ml_integration';

המאמרים הבאים