תחילת העבודה עם הטמעת וקטורים באמצעות AI של AlloyDB

1. מבוא

בשיעור הקוד הזה תלמדו איך להשתמש ב-AI של AlloyDB על ידי שילוב של חיפוש וקטורים עם הטמעות (embeddings) של Vertex AI.

17e86406ab251142.png

דרישות מוקדמות

  • הבנה בסיסית של מסוף Google Cloud
  • מיומנויות בסיסיות בממשק שורת הפקודה וב-Google Shell

מה תלמדו

  • איך לפרוס אשכול AlloyDB ומכונה ראשית
  • איך מתחברים ל-AlloyDB ממכונה וירטואלית ב-Google Compute Engine
  • איך יוצרים מסד נתונים ומפעילים את ה-AI של AlloyDB
  • איך טוענים נתונים למסד הנתונים
  • איך משתמשים במודל הטמעה של Vertex AI ב-AlloyDB
  • איך להעשיר את התוצאה באמצעות מודל גנרטיבי של Vertex AI
  • איך לשפר את הביצועים באמצעות אינדקס וקטור

מה צריך להכין

  • חשבון Google Cloud ופרויקט ב-Google Cloud
  • דפדפן אינטרנט כמו Chrome

2. הגדרה ודרישות

הגדרת סביבה בקצב אישי

  1. נכנסים למסוף Google Cloud ויוצרים פרויקט חדש או משתמשים מחדש בפרויקט קיים. אם עדיין אין לכם חשבון Gmail או חשבון Google Workspace, עליכם ליצור חשבון.

fbef9caa1602edd0.png

a99b7ace416376c4.png

5e3ff691252acf41.png

  • שם הפרויקט הוא השם המוצג של המשתתפים בפרויקט. זוהי מחרוזת תווים שלא משמשת את Google APIs. תמיד אפשר לעדכן אותו.
  • מזהה הפרויקט הוא ייחודי לכל הפרויקטים ב-Google Cloud ואי אפשר לשנות אותו אחרי שמגדירים אותו. מסוף Cloud יוצר מחרוזת ייחודית באופן אוטומטי. בדרך כלל לא משנה מה המחרוזת הזו. ברוב ה-codelabs תצטרכו להפנות למזהה הפרויקט (בדרך כלל מזהים אותו בתור PROJECT_ID). אם המזהה שנוצר לא מוצא חן בעיניכם, תוכלו ליצור מזהה אקראי אחר. לחלופין, אפשר לנסות כתובת משלכם ולבדוק אם היא זמינה. לא ניתן לשנות את השם אחרי השלב הזה, והוא יישאר למשך כל תקופת הפרויקט.
  • לידיעתך, יש ערך שלישי, מספר פרויקט, שמשתמשים בו בחלק מממשקי ה-API. מידע נוסף על כל שלושת הערכים האלה זמין במסמכי העזרה.
  1. בשלב הבא, כדי להשתמש במשאבים או ב-API של Cloud, תצטרכו להפעיל את החיוב במסוף Cloud. השלמת הקודלאב הזה לא תעלה הרבה, אם בכלל. כדי להשבית את המשאבים ולמנוע חיובים אחרי סיום המדריך, אפשר למחוק את המשאבים שיצרתם או למחוק את הפרויקט. משתמשים חדשים ב-Google Cloud זכאים להשתתף בתוכנית תקופת ניסיון בחינם בסך 300$.

הפעלת Cloud Shell

אפשר להפעיל את Google Cloud מרחוק מהמחשב הנייד, אבל בסדנת הקוד הזו נשתמש ב-Google Cloud Shell, סביבת שורת פקודה שפועלת ב-Cloud.

במסוף Google Cloud, לוחצים על סמל Cloud Shell בסרגל הכלים שבפינה הימנית העליונה:

55efc1aaa7a4d3ad.png

תהליך ההקצאה והחיבור לסביבת העבודה אמור להימשך רק כמה רגעים. בסיום, אמור להופיע משהו כזה:

7ffe5cbb04455448.png

המכונה הווירטואלית הזו כוללת את כל הכלים הדרושים למפתחים. יש בה ספריית בית בנפח מתמיד של 5GB והיא פועלת ב-Google Cloud, משפרת מאוד את ביצועי הרשת ואת האימות. אתם יכולים לבצע את כל העבודה בקודלאב הזה בדפדפן. אין צורך להתקין שום דבר.

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

הפעלת ה-API

פלט:

ב-Cloud Shell, מוודאים שמזהה הפרויקט מוגדר:

gcloud config set project [YOUR-PROJECT-ID]

מגדירים את משתנה הסביבה PROJECT_ID:

PROJECT_ID=$(gcloud config get-value project)

מפעילים את כל השירותים הנדרשים:

gcloud services enable alloydb.googleapis.com \
                       compute.googleapis.com \
                       cloudresourcemanager.googleapis.com \
                       servicenetworking.googleapis.com \
                       aiplatform.googleapis.com

הפלט הצפוי

student@cloudshell:~ (test-project-001-402417)$ gcloud config set project test-project-001-402417
Updated property [core/project].
student@cloudshell:~ (test-project-001-402417)$ PROJECT_ID=$(gcloud config get-value project)
Your active configuration is: [cloudshell-14650]
student@cloudshell:~ (test-project-001-402417)$ 
student@cloudshell:~ (test-project-001-402417)$ gcloud services enable alloydb.googleapis.com \
                       compute.googleapis.com \
                       cloudresourcemanager.googleapis.com \
                       servicenetworking.googleapis.com \
                       aiplatform.googleapis.com
Operation "operations/acat.p2-4470404856-1f44ebd8-894e-4356-bea7-b84165a57442" finished successfully.

מגדירים את אזור ברירת המחדל כך שישתמש במודלים של הטמעה (embedding) של Vertex AI. כאן מפורט מידע נוסף על המיקומים שבהם Vertex AI זמין. בדוגמה הזו אנחנו משתמשים באזור us-central1.

gcloud config set compute/region us-central1

4. פריסה של AlloyDB

לפני שיוצרים אשכול AlloyDB, צריך טווח IP פרטי זמין ב-VPC שלנו לשימוש במכונה העתידית של AlloyDB. אם אין לנו אותו, נצטרך ליצור אותו, להקצות אותו לשימוש בשירותים הפנימיים של Google ואז נוכל ליצור את האשכולות והמכונות.

יצירת טווח IP פרטי

אנחנו צריכים להגדיר את הגישה לשירות פרטי ב-VPC שלנו עבור AlloyDB. ההנחה היא שיש לנו רשת VPC 'ברירת מחדל' בפרויקט, והיא תשמש לכל הפעולות.

יוצרים את טווח כתובות ה-IP הפרטי:

gcloud compute addresses create psa-range \
    --global \
    --purpose=VPC_PEERING \
    --prefix-length=24 \
    --description="VPC private service access" \
    --network=default

יוצרים חיבור פרטי באמצעות טווח כתובות ה-IP שהוקצה:

gcloud services vpc-peerings connect \
    --service=servicenetworking.googleapis.com \
    --ranges=psa-range \
    --network=default

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-402417)$ gcloud compute addresses create psa-range \
    --global \
    --purpose=VPC_PEERING \
    --prefix-length=24 \
    --description="VPC private service access" \
    --network=default
Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/global/addresses/psa-range].

student@cloudshell:~ (test-project-402417)$ gcloud services vpc-peerings connect \
    --service=servicenetworking.googleapis.com \
    --ranges=psa-range \
    --network=default
Operation "operations/pssn.p24-4470404856-595e209f-19b7-4669-8a71-cbd45de8ba66" finished successfully.

student@cloudshell:~ (test-project-402417)$

יצירת אשכול AlloyDB

יוצרים אשכול AlloyDB באזור us-central1.

מגדירים סיסמה למשתמש postgres. אתם יכולים להגדיר סיסמה משלכם או להשתמש בפונקציה אקראית כדי ליצור סיסמה

export PGPASSWORD=`openssl rand -hex 12`

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-402417)$ export PGPASSWORD=`openssl rand -hex 12`

חשוב לזכור את הסיסמה ל-PostgreSQL לשימוש עתידי:

echo $PGPASSWORD

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-402417)$ echo $PGPASSWORD
bbefbfde7601985b0dee5723

מגדירים את האזור ואת שם האשכול של AlloyDB. נשתמש באזור us-central1 ובשם האשכולות alloydb-aip-01:

export REGION=us-central1
export ADBCLUSTER=alloydb-aip-01

מריצים את הפקודה כדי ליצור את האשכול:

gcloud alloydb clusters create $ADBCLUSTER \
    --password=$PGPASSWORD \
    --network=default \
    --region=$REGION

הפלט הצפוי במסוף:

export REGION=us-central1
export ADBCLUSTER=alloydb-aip-01
gcloud alloydb clusters create $ADBCLUSTER \
    --password=$PGPASSWORD \
    --network=default \
    --region=$REGION
Operation ID: operation-1697655441138-6080235852277-9e7f04f5-2012fce4
Creating cluster...done.                                                                                                                                                                                                                                                           

יצירת מכונה ראשית של AlloyDB

יוצרים מכונה ראשית של AlloyDB לאשכול שלנו באותו סשן של Cloud Shell. אם תנתקו, תצטרכו להגדיר מחדש את משתני הסביבה של שם האזור ושל האשכולות.

gcloud alloydb instances create $ADBCLUSTER-pr \
    --instance-type=PRIMARY \
    --cpu-count=2 \
    --region=$REGION \
    --cluster=$ADBCLUSTER

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-402417)$ gcloud alloydb instances create $ADBCLUSTER-pr \
    --instance-type=PRIMARY \
    --cpu-count=2 \
    --region=$REGION \
    --availability-type ZONAL \
    --cluster=$ADBCLUSTER
Operation ID: operation-1697659203545-6080315c6e8ee-391805db-25852721
Creating instance...done.                                                                                                                                                                                                                                                     

5. התחברות ל-AlloyDB

הפריסה של AlloyDB מתבצעת באמצעות חיבור פרטי בלבד, לכן נדרשת מכונה וירטואלית עם לקוח PostgreSQL מותקן כדי לעבוד עם מסד הנתונים.

פריסה של מכונה וירטואלית ב-GCE

יוצרים מכונה וירטואלית ב-GCE באותו אזור ובאותה רשת VPC שבהם נמצא אשכול AlloyDB.

ב-Cloud Shell, מריצים את הפקודה:

export ZONE=us-central1-a
gcloud compute instances create instance-1 \
    --zone=$ZONE \
    --create-disk=auto-delete=yes,boot=yes,image=projects/debian-cloud/global/images/$(gcloud compute images list --filter="family=debian-12 AND family!=debian-12-arm64" --format="value(name)") \
    --scopes=https://www.googleapis.com/auth/cloud-platform

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-402417)$ export ZONE=us-central1-a
student@cloudshell:~ (test-project-402417)$ export ZONE=us-central1-a
gcloud compute instances create instance-1 \
    --zone=$ZONE \
    --create-disk=auto-delete=yes,boot=yes,image=projects/debian-cloud/global/images/$(gcloud compute images list --filter="family=debian-12 AND family!=debian-12-arm64" --format="value(name)") \
    --scopes=https://www.googleapis.com/auth/cloud-platform

Created [https://www.googleapis.com/compute/v1/projects/test-project-402417/zones/us-central1-a/instances/instance-1].
NAME: instance-1
ZONE: us-central1-a
MACHINE_TYPE: n1-standard-1
PREEMPTIBLE: 
INTERNAL_IP: 10.128.0.2
EXTERNAL_IP: 34.71.192.233
STATUS: RUNNING

התקנה של לקוח Postgres

התקנת תוכנת הלקוח של PostgreSQL במכונה הווירטואלית שנפרסה

מתחברים ל-VM:

gcloud compute ssh instance-1 --zone=us-central1-a

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-402417)$ gcloud compute ssh instance-1 --zone=us-central1-a
Updating project ssh metadata...working..Updated [https://www.googleapis.com/compute/v1/projects/test-project-402417].                                                                                                                                                         
Updating project ssh metadata...done.                                                                                                                                                                                                                                              
Waiting for SSH key to propagate.
Warning: Permanently added 'compute.5110295539541121102' (ECDSA) to the list of known hosts.
Linux instance-1.us-central1-a.c.gleb-test-short-001-418811.internal 6.1.0-18-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
student@instance-1:~$ 

מתקינים את פקודת ההפעלה של התוכנה בתוך ה-VM:

sudo apt-get update
sudo apt-get install --yes postgresql-client

הפלט הצפוי במסוף:

student@instance-1:~$ sudo apt-get update
sudo apt-get install --yes postgresql-client
Get:1 https://packages.cloud.google.com/apt google-compute-engine-bullseye-stable InRelease [5146 B]
Get:2 https://packages.cloud.google.com/apt cloud-sdk-bullseye InRelease [6406 B]   
Hit:3 https://deb.debian.org/debian bullseye InRelease  
Get:4 https://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:5 https://packages.cloud.google.com/apt google-compute-engine-bullseye-stable/main amd64 Packages [1930 B]
Get:6 https://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:7 https://deb.debian.org/debian bullseye-backports InRelease [49.0 kB]
...redacted...
update-alternatives: using /usr/share/postgresql/13/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up postgresql-client (13+225) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u7) ...

התחברות למכונה

מתחברים למכונה הווירטואלית מהמכונה הראשית באמצעות psql.

באותה כרטיסייה ב-Cloud Shell שבה נפתח סשן ה-SSH למכונה הווירטואלית instance-1.

משתמשים בערך הסיסמה של AlloyDB (PGPASSWORD) ובמזהה האשכולות של AlloyDB כדי להתחבר ל-AlloyDB מהמכונה הווירטואלית ב-GCE:

export PGPASSWORD=<Noted password>
export PROJECT_ID=$(gcloud config get-value project)
export REGION=us-central1
export ADBCLUSTER=alloydb-aip-01
export INSTANCE_IP=$(gcloud alloydb instances describe $ADBCLUSTER-pr --cluster=$ADBCLUSTER --region=$REGION --format="value(ipAddress)")
psql "host=$INSTANCE_IP user=postgres sslmode=require"

הפלט הצפוי במסוף:

student@instance-1:~$ export PGPASSWORD=CQhOi5OygD4ps6ty
student@instance-1:~$ ADBCLUSTER=alloydb-aip-01
student@instance-1:~$ REGION=us-central1
student@instance-1:~$ INSTANCE_IP=$(gcloud alloydb instances describe $ADBCLUSTER-pr --cluster=$ADBCLUSTER --region=$REGION --format="value(ipAddress)")
gleb@instance-1:~$ psql "host=$INSTANCE_IP user=postgres sslmode=require"
psql (15.6 (Debian 15.6-0+deb12u1), server 15.5)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.

postgres=>

סוגרים את הסשן של psql:

exit

6. הכנת מסד הנתונים

אנחנו צריכים ליצור מסד נתונים, להפעיל את השילוב עם Vertex AI, ליצור אובייקטים של מסד נתונים ולייבא את הנתונים.

מתן ההרשאות הנדרשות ל-AlloyDB

מוסיפים את ההרשאות של Vertex AI לסוכן השירות של AlloyDB.

פותחים כרטיסייה נוספת ב-Cloud Shell באמצעות הסימן '+' בחלק העליון.

4ca978f5142bb6ce.png

בכרטיסייה החדשה של Cloud Shell, מריצים את הפקודה:

PROJECT_ID=$(gcloud config get-value project)
gcloud projects add-iam-policy-binding $PROJECT_ID \
  --member="serviceAccount:service-$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")@gcp-sa-alloydb.iam.gserviceaccount.com" \
  --role="roles/aiplatform.user"

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-001-402417)$ PROJECT_ID=$(gcloud config get-value project)
Your active configuration is: [cloudshell-11039]
student@cloudshell:~ (test-project-001-402417)$ gcloud projects add-iam-policy-binding $PROJECT_ID \
  --member="serviceAccount:service-$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")@gcp-sa-alloydb.iam.gserviceaccount.com" \
  --role="roles/aiplatform.user"
Updated IAM policy for project [test-project-001-402417].
bindings:
- members:
  - serviceAccount:service-4470404856@gcp-sa-alloydb.iam.gserviceaccount.com
  role: roles/aiplatform.user
- members:
...
etag: BwYIEbe_Z3U=
version: 1
 

סוגרים את הכרטיסייה באמצעות הפקודה 'exit' בכרטיסייה:

exit

יצירת מסד נתונים

מדריך למתחילים בנושא יצירת מסד נתונים.

בסשן של המכונה הווירטואלית ב-GCE, מריצים את הפקודה:

יצירת מסד נתונים:

psql "host=$INSTANCE_IP user=postgres" -c "CREATE DATABASE quickstart_db"

הפלט הצפוי במסוף:

student@instance-1:~$ psql "host=$INSTANCE_IP user=postgres" -c "CREATE DATABASE quickstart_db"
CREATE DATABASE
student@instance-1:~$  

הפעלת השילוב עם Vertex AI

מפעילים את השילוב של Vertex AI ואת התוספים של pgvector במסד הנתונים.

במכונה הווירטואלית של GCE, מריצים את הפקודה:

psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "CREATE EXTENSION IF NOT EXISTS google_ml_integration CASCADE"
psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "CREATE EXTENSION IF NOT EXISTS vector"

הפלט הצפוי במסוף:

student@instance-1:~$ psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "CREATE EXTENSION IF NOT EXISTS google_ml_integration CASCADE"
psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "CREATE EXTENSION IF NOT EXISTS vector"
CREATE EXTENSION
CREATE EXTENSION
student@instance-1:~$ 

ייבוא נתונים

מורידים את הנתונים שהוכן ומביאים אותם למסד הנתונים החדש.

במכונה הווירטואלית של GCE, מריצים את הפקודה:

gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_demo_schema.sql |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db"
gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_products.csv |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "\copy cymbal_products from stdin csv header"
gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_inventory.csv |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "\copy cymbal_inventory from stdin csv header"
gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_stores.csv |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "\copy cymbal_stores from stdin csv header"

הפלט הצפוי במסוף:

student@instance-1:~$ gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_demo_schema.sql |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db"
SET
SET
SET
SET
SET
 set_config 
------------
 
(1 row)
SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
CREATE SEQUENCE
ALTER TABLE
ALTER SEQUENCE
ALTER TABLE
ALTER TABLE
ALTER TABLE
student@instance-1:~$ gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_products.csv |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "\copy cymbal_products from stdin csv header"
COPY 941
student@instance-1:~$ gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_inventory.csv |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "\copy cymbal_inventory from stdin csv header"
COPY 263861
student@instance-1:~$ gsutil cat gs://cloud-training/gcc/gcc-tech-004/cymbal_stores.csv |psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db" -c "\copy cymbal_stores from stdin csv header"
COPY 4654
student@instance-1:~$

7. חישוב הטמעות (embeddings)

אחרי ייבוא הנתונים, קיבלנו את נתוני המוצרים בטבלה cymbal_products, מלאי שמציג את מספר המוצרים הזמינים בכל חנות בטבלה cymbal_inventory ורשימה של החנויות בטבלה cymbal_stores. אנחנו צריכים לחשב את נתוני הווקטור על סמך התיאורים של המוצרים שלנו, ולשם כך נשתמש בפונקציה הטמעה. באמצעות הפונקציה, נשתמש בשילוב של Vertex AI כדי לחשב נתוני וקטור על סמך תיאורי המוצרים שלנו ולהוסיף אותם לטבלה. מידע נוסף על הטכנולוגיה שבה נעשה שימוש זמין במסמכים.

יצירת עמודה להטמעה

מתחברים למסד הנתונים באמצעות psql ויוצרים עמודה וירטואלית עם נתוני הווקטור באמצעות פונקציית ההטמעה בטבלה cymbal_products. פונקציית ההטמעה מחזירה נתוני וקטור מ-Vertex AI על סמך הנתונים שסופקו מהעמודה product_description.

psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db"

בסשן psql, אחרי שמתחברים למסד הנתונים, מריצים את הפקודה:

ALTER TABLE cymbal_products ADD COLUMN embedding vector(768) GENERATED ALWAYS AS (embedding('text-embedding-004',product_description)) STORED;

הפקודה תיצור את העמודה הווירטואלית ותאכלס אותה בנתוני וקטורים.

הפלט הצפוי במסוף:

student@instance-1:~$ psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db"
psql (13.11 (Debian 13.11-0+deb11u1), server 14.7)
WARNING: psql major version 13, server major version 14.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

quickstart_db=> ALTER TABLE cymbal_products ADD COLUMN embedding vector(768) GENERATED ALWAYS AS (embedding('text-embedding-004',product_description)) STORED;
ALTER TABLE
quickstart_db=> 

8. הפעלת חיפוש הדמיון

עכשיו אנחנו יכולים להריץ את החיפוש באמצעות חיפוש דמיון שמבוסס על ערכי וקטורים שמחושבים לתיאורים ועל ערך הווקטור שאנחנו מקבלים מהבקשה.

אפשר להריץ את שאילתה ה-SQL מאותו ממשק שורת הפקודה של psql, או לחלופין מ-AlloyDB Studio. פלט מורכב עם כמה שורות עשוי להיראות טוב יותר ב-AlloyDB Studio.

התחברות ל-AlloyDB Studio

בפרקים הבאים, אפשר להריץ ב-AlloyDB Studio את כל פקודות ה-SQL שדורשות חיבור למסד הנתונים. כדי להריץ את הפקודה, לוחצים על המכונה הראשית כדי לפתוח את הממשק של מסוף האינטרנט של אשכול AlloyDB.

ef4bfbcf0ed2ef3a.png

לאחר מכן לוחצים על AlloyDB Studio בצד ימין:

5c155cbcd7d43a1.png

בוחרים את מסד הנתונים quickstart_db, את המשתמש postgres ומזינים את הסיסמה שציינתם כשיצרתם את האשכולות. לאחר מכן לוחצים על הלחצן 'אימות'.

432613065cac864f.png

הממשק של AlloyDB Studio ייפתח. כדי להריץ את הפקודות במסד הנתונים, לוחצים על הכרטיסייה Editor 1 (עריכה 1) בצד שמאל.

b36c28f8165119ca.png

ייפתח ממשק שבו אפשר להריץ פקודות SQL.

cf43aa20f292797e.png

אם אתם מעדיפים להשתמש ב-psql בשורת הפקודה, עליכם לפעול לפי הנתיב החלופי ולהתחבר למסד הנתונים מהסשן של SSH ב-VM, כפי שמתואר בפרקים הקודמים.

הרצת חיפוש הדמיון מ-psql

אם הסשן של מסד הנתונים התנתק, צריך להתחבר שוב למסד הנתונים באמצעות psql או AlloyDB Studio.

מתחברים למסד הנתונים:

psql "host=$INSTANCE_IP user=postgres dbname=quickstart_db"

מריצים שאילתה כדי לקבל רשימה של מוצרים זמינים שקשורים בצורה הכי הדוקה לבקשה של הלקוח. הבקשה שנעביר ל-Vertex AI כדי לקבל את ערך הווקטור נשמעת כך: "What kind of fruit trees grow well here?‎"

זו השאילתה שאפשר להריץ כדי לבחור את 10 הפריטים הראשונים הכי מתאימים לבקשה שלנו:

SELECT
        cp.product_name,
        left(cp.product_description,80) as description,
        cp.sale_price,
        cs.zip_code,
        (cp.embedding <=> embedding('text-embedding-004','What kind of fruit trees grow well here?')::vector) as distance
FROM
        cymbal_products cp
JOIN cymbal_inventory ci on
        ci.uniq_id=cp.uniq_id
JOIN cymbal_stores cs on
        cs.store_id=ci.store_id
        AND ci.inventory>0
        AND cs.store_id = 1583
ORDER BY
        distance ASC
LIMIT 10;

זהו הפלט הצפוי:

quickstart_db=> SELECT
        cp.product_name,
        left(cp.product_description,80) as description,
        cp.sale_price,
        cs.zip_code,
        (cp.embedding <=> embedding('text-embedding-004','What kind of fruit trees grow well here?')::vector) as distance
FROM
        cymbal_products cp
JOIN cymbal_inventory ci on
        ci.uniq_id=cp.uniq_id
JOIN cymbal_stores cs on
        cs.store_id=ci.store_id
        AND ci.inventory>0
        AND cs.store_id = 1583
ORDER BY
        distance ASC
LIMIT 10;
      product_name       |                                   description                                    | sale_price | zip_code |      distance       
-------------------------+----------------------------------------------------------------------------------+------------+----------+---------------------
 Cherry Tree             | This is a beautiful cherry tree that will produce delicious cherries. It is an d |      75.00 |    93230 | 0.43922018972266397
 Meyer Lemon Tree        | Meyer Lemon trees are California's favorite lemon tree! Grow your own lemons by  |         34 |    93230 |  0.4685112926118228
 Toyon                   | This is a beautiful toyon tree that can grow to be over 20 feet tall. It is an e |      10.00 |    93230 |  0.4835677149651668
 California Lilac        | This is a beautiful lilac tree that can grow to be over 10 feet tall. It is an d |       5.00 |    93230 |  0.4947204525907498
 California Peppertree   | This is a beautiful peppertree that can grow to be over 30 feet tall. It is an e |      25.00 |    93230 |  0.5054166905547247
 California Black Walnut | This is a beautiful walnut tree that can grow to be over 80 feet tall. It is a d |     100.00 |    93230 |  0.5084219510932597
 California Sycamore     | This is a beautiful sycamore tree that can grow to be over 100 feet tall. It is  |     300.00 |    93230 |  0.5140519790508755
 Coast Live Oak          | This is a beautiful oak tree that can grow to be over 100 feet tall. It is an ev |     500.00 |    93230 |  0.5143126438081371
 Fremont Cottonwood      | This is a beautiful cottonwood tree that can grow to be over 100 feet tall. It i |     200.00 |    93230 |  0.5174774727252058
 Madrone                 | This is a beautiful madrona tree that can grow to be over 80 feet tall. It is an |      50.00 |    93230 |  0.5227400803389093

9. שיפור התשובה

אפשר לשפר את התשובה לאפליקציית לקוח באמצעות תוצאת השאילתה, ולהכין פלט בעל משמעות באמצעות תוצאות השאילתה שסופקו כחלק מההנחיה למודל השפה הבסיסי הגנרטיבי של Vertex AI.

כדי לעשות זאת, אנחנו מתכננים ליצור קובץ JSON עם התוצאות שלנו מחיפוש הווקטור, ואז להשתמש בקובץ ה-JSON שנוצר כתוספת להנחיה של מודל LLM לטקסט ב-Vertex AI כדי ליצור פלט בעל משמעות. בשלב הראשון יוצרים את קובץ ה-JSON, בשלב השני בודקים אותו ב-Vertex AI Studio ובשלב האחרון משלבים אותו בהצהרת SQL שאפשר להשתמש בה באפליקציה.

יצירת פלט בפורמט JSON

משנים את השאילתה כך שתייצר את הפלט בפורמט JSON ותחזיר רק שורה אחת להעברה אל Vertex AI

זו דוגמה לשאילתה:

WITH trees as (
SELECT
        cp.product_name,
        left(cp.product_description,80) as description,
        cp.sale_price,
        cs.zip_code,
        cp.uniq_id as product_id
FROM
        cymbal_products cp
JOIN cymbal_inventory ci on
        ci.uniq_id=cp.uniq_id
JOIN cymbal_stores cs on
        cs.store_id=ci.store_id
        AND ci.inventory>0
        AND cs.store_id = 1583
ORDER BY
        (cp.embedding <=> embedding('text-embedding-004','What kind of fruit trees grow well here?')::vector) ASC
LIMIT 1)
SELECT json_agg(trees) FROM trees;

זהו ה-JSON הצפוי בפלט:

[{"product_name":"Cherry Tree","description":"This is a beautiful cherry tree that will produce delicious cherries. It is an d","sale_price":75.00,"zip_code":93230,"product_id":"d536e9e823296a2eba198e52dd23e712"}]

הרצת ההנחיה ב-Vertex AI Studio

אפשר להשתמש ב-JSON שנוצר כדי לספק אותו כחלק מההנחיה למודל טקסט של AI גנרטיבי ב-Vertex AI Studio

פותחים את Vertex AI Studio במסוף Cloud.

e514b176aef7945e.png

54712e5ade7121f.png

יכול להיות שתתבקשו להפעיל ממשקי API נוספים, אבל אתם יכולים להתעלם מהבקשה. אין צורך ב-API נוסף כדי לסיים את שיעור ה-Lab.

זו ההנחיה שבה נשתמש:

אתם יועצים ידידותיים שעוזרים למצוא מוצר בהתאם לצרכים של הלקוח.

על סמך בקשת הלקוח, הטענו רשימה של מוצרים שקשורים מאוד לחיפוש.

הרשימה בפורמט JSON עם רשימת ערכים כמו {"product_name":"name","description":"some description","sale_price":10,"zip_code": 10234, "produt_id": "02056727942aeb714dc9a2313654e1b0"}

זו רשימת המוצרים:

[place for our JSON]

הלקוח שאל "איזה עץ הכי מתאים לגידול כאן?"

כדאי לספק מידע על המוצר, המחיר ומידע משלים מסוים' כהודעת הנחיה

זו התוצאה כשמריצים את ההנחיה עם ערכי ה-JSON שלנו תוך שימוש במודל gemini-1.5-flash:

30e5072cd2975685.png

זו התשובה שקיבלנו מהמודל בדוגמה הזו. חשוב לזכור שהתשובה עשויה להיות שונה בגלל שינויים במודל ובפרמטרים לאורך זמן:

"אני רואה שביקשת עץ שיכול לגדול באזור שלך. על סמך המיקוד שלך, 93230, נראה שהמלון Cherry Tree הוא אפשרות נהדרת!

הוא מתואר כעץ יפה שמיוצרים בו דובדבנים טעימים. המחיר הנוכחי במבצע הוא 290.00 ש"ח.

אין לי פרטים ספציפיים לגבי קצב הצמיחה של העץ באזור שלך, אבל בדרך כלל עצי דובדבן מעדיפים אדמה מנוקזת היטב ושמש מלאה.

כדי להבטיח את התוצאות הטובות ביותר, מומלץ להתייעץ עם משתלה מקומית או עם מומחה גינון מקומי שיכול לספק עצות מותאמות יותר למיקום הספציפי ולתנאי האדמה שלך. הם גם יכולים לעזור לכם לבחור את הזן המתאים ביותר לצרכים שלכם, ולספק טיפים לגבי שתילה וטיפול".

הרצת ההנחיה ב-PSQL

אנחנו יכולים להשתמש בשילוב של AI ב-AlloyDB עם Vertex AI כדי לקבל את אותה תשובה ממודל גנרטיבי באמצעות SQL ישירות במסד הנתונים. אבל כדי להשתמש במודל gemini-1.5-flash, קודם צריך לרשום אותו.

משדרגים את התוסף לגרסה 1.4.1 (אם הגרסה הנוכחית נמוכה יותר). מתחברים למסד הנתונים quickstart_db מ-psql כפי שצוין קודם (או משתמשים ב-AlloyDB Studio) ומריצים את הפקודה:

SELECT extversion from pg_extension where extname='google_ml_integration';

אם הערך המוחזר נמוך מ-1.4.1, מבצעים את הפקודה הבאה:

ALTER EXTENSION google_ml_integration UPDATE TO '1.4.1';

לאחר מכן, צריך להגדיר את הדגל של מסד הנתונים google_ml_integration.enable_model_support ל-'on'. כדי לעשות זאת, אפשר להשתמש בממשק של מסוף האינטרנט של AlloyDB או להריץ את פקודת gcloud הבאה.

PROJECT_ID=$(gcloud config get-value project)
REGION=us-central1
ADBCLUSTER=alloydb-aip-01
gcloud beta alloydb instances update $ADBCLUSTER-pr \
  --database-flags google_ml_integration.enable_model_support=on \
  --region=$REGION \
  --cluster=$ADBCLUSTER \
  --project=$PROJECT_ID \
  --update-mode=FORCE_APPLY

הפקודה מופעלת ברקע תוך 3-5 דקות. לאחר מכן תוכלו לאמת את הדגל החדש בסשן psql או באמצעות AlloyDB Studio בחיבור למסד הנתונים quickstart_db.

show google_ml_integration.enable_model_support;

הפלט הצפוי מהסשן של psql הוא 'on':

postgres=> show google_ml_integration.enable_model_support;
 google_ml_integration.enable_model_support 
--------------------------------------------
 on
(1 row)

לאחר מכן צריך לרשום שני מודלים. המודל הראשון הוא המודל text-embedding-004 שכבר נעשה בו שימוש. צריך לרשום אותו כי הפעלנו את היכולות של רישום הדגם.

כדי לרשום את מודל ההרצה ב-psql או ב-AlloyDB Studio, מזינים את הקוד הבא:

CALL
  google_ml.create_model(
    model_id => 'text-embedding-004',
    model_provider => 'google',
    model_qualified_name => 'text-embedding-004',
    model_type => 'text_embedding',
    model_auth_type => 'alloydb_service_agent_iam',
    model_in_transform_fn => 'google_ml.vertexai_text_embedding_input_transform',
    model_out_transform_fn => 'google_ml.vertexai_text_embedding_output_transform');

המודל הבא שצריך לרשום הוא gemini-1.5-flash-002, שמשמש ליצירת הפלט שמתאים למשתמש.

CALL
  google_ml.create_model(
    model_id => 'gemini-1.5-flash-002',
    model_request_url => 'https://$REGION-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/$REGION/publishers/google/models/gemini-1.5-flash-002:streamGenerateContent',
    model_provider => 'google',
    model_auth_type => 'alloydb_service_agent_iam');

תמיד אפשר לבדוק את רשימת המודלים הרשומים על ידי בחירת מידע מ-google_ml.model_info_view.

select model_id,model_type from google_ml.model_info_view;

הנה פלט לדוגמה

quickstart_db=> select model_id,model_type from google_ml.model_info_view;
        model_id         |   model_type   
-------------------------+----------------
 textembedding-gecko     | text_embedding
 textembedding-gecko@001 | text_embedding
 text-embedding-004      | text_embedding
 gemini-1.5-flash-001    | generic
(4 rows)

עכשיו אפשר להשתמש ב-JSON שנוצר בשאילתת משנה כדי לספק אותו כחלק מההנחיה למודל טקסט של AI גנרטיבי באמצעות SQL.

מריצים את השאילתה בסשן psql או AlloyDB Studio למסד הנתונים

WITH trees AS (
SELECT
        cp.product_name,
        cp.product_description AS description,
        cp.sale_price,
        cs.zip_code,
        cp.uniq_id AS product_id
FROM
        cymbal_products cp
JOIN cymbal_inventory ci ON
        ci.uniq_id = cp.uniq_id
JOIN cymbal_stores cs ON
        cs.store_id = ci.store_id
        AND ci.inventory>0
        AND cs.store_id = 1583
ORDER BY
        (cp.embedding <=> embedding('text-embedding-004',
        'What kind of fruit trees grow well here?')::vector) ASC
LIMIT 1),
prompt AS (
SELECT
        'You are a friendly advisor helping to find a product based on the customer''s needs.
Based on the client request we have loaded a list of products closely related to search.
The list in JSON format with list of values like {"product_name":"name","product_description":"some description","sale_price":10}
Here is the list of products:' || json_agg(trees) || 'The customer asked "What kind of fruit trees grow well here?"
You should give information about the product, price and some supplemental information' AS prompt_text
FROM
        trees),
response AS (
SELECT
        json_array_elements(google_ml.predict_row( model_id =>'gemini-1.5-flash-002',
        request_body => json_build_object('contents',
        json_build_object('role',
        'user',
        'parts',
        json_build_object('text',
        prompt_text)))))->'candidates'->0->'content'->'parts'->0->'text' AS resp
FROM
        prompt)
SELECT
        string_agg(resp::text,
        ' ')
FROM
        response;

זהו הפלט הצפוי. הפלט עשוי להיות שונה בהתאם לגרסת המודל ולפרמטרים.

"That" "'s a great question! Based on your location (assuming you're" " in zip code 93230), I have a suggestion for a" " fruit tree that should thrive.\n\nWe have the **Cherry Tree** available.\n\n**Product Name:** Cherry Tree\n\n**Description:** This is a beautiful cherry" " tree that will produce delicious cherries. It's a deciduous tree (meaning it loses its leaves in the fall) growing to about 15 feet tall." " The leaves are dark green in summer, turning a beautiful red in the fall. Cherry trees are known for their beauty, shade, and privacy.\n\n**Sale Price:** $75.00\n\n**Important Considerations for Growing" " Cherry Trees:**\n\n* **Climate:** Cherry trees prefer a cool, moist climate, and 93230 falls within a suitable range (USDA zones 4-9). However, it's always a good idea to" " check the specific microclimate of your property (sun exposure, drainage etc.).\n* **Soil:** They do best in sandy soil. If your soil is different, you may need to amend it to improve drainage.\n* **Pollination:** Many cherry varieties require a second, compatible cherry tree for proper pollination" ". Check the specific pollination needs of this variety before purchase if you want a significant cherry yield.\n\nThis cherry tree is a beautiful addition to any yard and will provide you with delicious cherries if you can meet its needs. Would you like to know more about its pollination requirements, or perhaps see if we have any other" " fruit trees suitable for your area?\n" ""

10. יצירת אינדקס וקטור

מערך הנתונים שלנו קטן למדי, וזמן התגובה תלוי בעיקר באינטראקציה עם מודלים של AI. אבל כשיש מיליוני וקטורים, חלק החיפוש של הוקטורים יכול להימשך חלק משמעותי מזמן התגובה שלנו ולהעמיס מאוד על המערכת. כדי לשפר את המצב, אפשר ליצור אינדקס מעל הווקטורים שלנו.

יצירת מדד ScaNN

כדי ליצור את האינדקס SCANN, צריך להפעיל עוד תוסף אחד. התוסף alloydb_scann מספק לנו ממשק לעבודה עם אינדקס וקטור מסוג ANN באמצעות אלגוריתם Google ScaNN.

CREATE EXTENSION IF NOT EXISTS alloydb_scann;

הפלט אמור להיראות כך:

quickstart_db=> CREATE EXTENSION IF NOT EXISTS alloydb_scann;
CREATE EXTENSION
Time: 27.468 ms
quickstart_db=> 

עכשיו אפשר ליצור את האינדקס. בדוגמה הבאה, השארתי את רוב הפרמטרים כברירת מחדל וסיפקתי רק מספר מחיצות (num_leaves) לאינדקס:

CREATE INDEX cymbal_products_embeddings_scann ON cymbal_products
  USING scann (embedding cosine)
  WITH (num_leaves=31, max_num_levels = 2);

מידע נוסף על שינוי הפרמטרים של האינדקס זמין במסמכי התיעוד.

הפלט אמור להיראות כך:

quickstart_db=> CREATE INDEX cymbal_products_embeddings_scann ON cymbal_products
  USING scann (embedding cosine)
  WITH (num_leaves=31, max_num_levels = 2);
CREATE INDEX
quickstart_db=>

השוואת תגובות

עכשיו אפשר להריץ את שאילתת החיפוש של הווקטור במצב EXPLAIN ולאמת אם נעשה שימוש באינדקס.

EXPLAIN (analyze) 
WITH trees as (
SELECT
        cp.product_name,
        left(cp.product_description,80) as description,
        cp.sale_price,
        cs.zip_code,
        cp.uniq_id as product_id
FROM
        cymbal_products cp
JOIN cymbal_inventory ci on
        ci.uniq_id=cp.uniq_id
JOIN cymbal_stores cs on
        cs.store_id=ci.store_id
        AND ci.inventory>0
        AND cs.store_id = 1583
ORDER BY
        (cp.embedding <=> embedding('text-embedding-004','What kind of fruit trees grow well here?')::vector) ASC
LIMIT 1)
SELECT json_agg(trees) FROM trees;

הפלט אמור להיראות כך:

Aggregate (cost=16.59..16.60 rows=1 width=32) (actual time=2.875..2.877 rows=1 loops=1)
-> Subquery Scan on trees (cost=8.42..16.59 rows=1 width=142) (actual time=2.860..2.862 rows=1 loops=1)
-> Limit (cost=8.42..16.58 rows=1 width=158) (actual time=2.855..2.856 rows=1 loops=1)
-> Nested Loop (cost=8.42..6489.19 rows=794 width=158) (actual time=2.854..2.855 rows=1 loops=1)
-> Nested Loop (cost=8.13..6466.99 rows=794 width=938) (actual time=2.742..2.743 rows=1 loops=1)
-> Index Scan using cymbal_products_embeddings_scann on cymbal_products cp (cost=7.71..111.99 rows=876 width=934) (actual time=2.724..2.724 rows=1 loops=1)
Order By: (embedding <=> '[0.008864171,0.03693164,-0.024245683,-0.00355923,0.0055611245,0.015985578,...<redacted>...5685,-0.03914233,-0.018452475,0.00826032,-0.07372604]'::vector)
-> Index Scan using walmart_inventory_pkey on cymbal_inventory ci (cost=0.42..7.26 rows=1 width=37) (actual time=0.015..0.015 rows=1 loops=1)
Index Cond: ((store_id = 1583) AND (uniq_id = (cp.uniq_id)::text))

אפשר לראות בבירור בפלט שהשאילתה השתמשה ב-'סריקת אינדקס באמצעות cymbal_products_embeddings_scann ב-cymbal_products'.

ואם מריצים את השאילתה בלי explain:

WITH trees as (
SELECT
        cp.product_name,
        left(cp.product_description,80) as description,
        cp.sale_price,
        cs.zip_code,
        cp.uniq_id as product_id
FROM
        cymbal_products cp
JOIN cymbal_inventory ci on
        ci.uniq_id=cp.uniq_id
JOIN cymbal_stores cs on
        cs.store_id=ci.store_id
        AND ci.inventory>0
        AND cs.store_id = 1583
ORDER BY
        (cp.embedding <=> embedding('text-embedding-004','What kind of fruit trees grow well here?')::vector) ASC
LIMIT 1)
SELECT json_agg(trees) FROM trees;

הפלט אמור להיראות כך:

[{"product_name":"Meyer Lemon Tree","description":"Meyer Lemon trees are California's favorite lemon tree! Grow your own lemons by ","sale_price":34,"zip_code":93230,"product_id":"02056727942aeb714dc9a2313654e1b0"}]

אפשר לראות שהתוצאה שונה במקצת, ולא מופיע בה עץ הדובדבן שהופיע במקום הראשון בחיפוש שלנו ללא הוספה לאינדקס, אלא האפשרות השנייה – עץ הלימון של מיייר. כך שהמדד מספק לנו ביצועים, אבל הוא עדיין מדויק מספיק כדי לספק תוצאות טובות.

בדף התיעוד תוכלו לנסות אינדקסים שונים שזמינים לווקטורים, ולמצוא דוגמאות נוספות ושיעורי Lab עם שילוב של שרשרת שפות.

11. פינוי הסביבה

איך משמידים את המכונות ואת האשכול של AlloyDB בסיום ה-Lab

מחיקת אשכול AlloyDB וכל המכונות

האשכולות נהרסים באמצעות האפשרות force, שמוחקת גם את כל המכונות ששייכות לאשכולות.

אם התנתקתם וכל ההגדרות הקודמות אבדו, מגדירים את הפרויקט ומשתני הסביבה ב-Cloud Shell:

gcloud config set project <your project id>
export REGION=us-central1
export ADBCLUSTER=alloydb-aip-01
export PROJECT_ID=$(gcloud config get-value project)

מוחקים את האשכול:

gcloud alloydb clusters delete $ADBCLUSTER --region=$REGION --force

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-001-402417)$ gcloud alloydb clusters delete $ADBCLUSTER --region=$REGION --force
All of the cluster data will be lost when the cluster is deleted.

Do you want to continue (Y/n)?  Y

Operation ID: operation-1697820178429-6082890a0b570-4a72f7e4-4c5df36f
Deleting cluster...done.   

מחיקת גיבויים של AlloyDB

מוחקים את כל הגיבויים של AlloyDB לאשכול:

for i in $(gcloud alloydb backups list --filter="CLUSTER_NAME: projects/$PROJECT_ID/locations/$REGION/clusters/$ADBCLUSTER" --format="value(name)" --sort-by=~createTime) ; do gcloud alloydb backups delete $(basename $i) --region $REGION --quiet; done

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-001-402417)$ for i in $(gcloud alloydb backups list --filter="CLUSTER_NAME: projects/$PROJECT_ID/locations/$REGION/clusters/$ADBCLUSTER" --format="value(name)" --sort-by=~createTime) ; do gcloud alloydb backups delete $(basename $i) --region $REGION --quiet; done
Operation ID: operation-1697826266108-60829fb7b5258-7f99dc0b-99f3c35f
Deleting backup...done.                                                                                                                                                                                                                                                            

עכשיו אפשר למחוק את המכונה הווירטואלית

מחיקת מכונה וירטואלית ב-GCE

ב-Cloud Shell, מריצים את הפקודה:

export GCEVM=instance-1
export ZONE=us-central1-a
gcloud compute instances delete $GCEVM \
    --zone=$ZONE \
    --quiet

הפלט הצפוי במסוף:

student@cloudshell:~ (test-project-001-402417)$ export GCEVM=instance-1
export ZONE=us-central1-a
gcloud compute instances delete $GCEVM \
    --zone=$ZONE \
    --quiet
Deleted 

12. מזל טוב

כל הכבוד על השלמת ה-Codelab.

מה עסקנו בו

  • איך לפרוס אשכול AlloyDB ומכונה ראשית
  • איך מתחברים ל-AlloyDB ממכונה וירטואלית ב-Google Compute Engine
  • איך יוצרים מסד נתונים ומפעילים את ה-AI של AlloyDB
  • איך טוענים נתונים למסד הנתונים
  • איך משתמשים במודל הטמעה של Vertex AI ב-AlloyDB
  • איך להעשיר את התוצאה באמצעות מודל גנרטיבי של Vertex AI
  • איך לשפר את הביצועים באמצעות אינדקס וקטור

13. סקר

פלט:

איך תוכלו להשתמש במדריך הזה?

רק לקרוא לקרוא ולבצע את התרגילים