מצבי פריסה הם הגדרה ברמת הפרויקט. המעבר בין שני המצבים לא מעביר או מוחק את הנתונים שלכם מהמצב השני. אפשר להשתמש ב-UpdateRagEngineConfig API כדי לעבור בין מצבי הפריסה Serverless ו-Spanner. אפשר גם להשתמש ב-API הזה כדי להגדיר את הרמה במצב הפריסה של Spanner או כדי לבטל את ההקצאה של מצב Spanner ולהפסיק את החיוב. אתם יכולים להשתמש ב-GetRagEngineConfig API כדי לקרוא את המידע על מצב הפריסה הנוכחי.
מעבר למצב Serverless
בדוגמאות הקוד הבאות אפשר לראות איך להעביר את RagEngineConfig למצב Serverless:
המסוף
- נכנסים לדף RAG Engine במסוף Google Cloud .
- בוחרים את האזור שבו מנוע ה-RAG פועל.
- לוחצים על האפשרות מעבר למצב Serverless. יכול להיות שהאפשרות הזו לא תופיע אם אתם במצב Serverless. אפשר לבדוק את המצב הנוכחי לפי התווית של המצב בפינה השמאלית העליונה של הדף.
REST
PROJECT_ID: Your project ID.
LOCATION: The region to process the request.
curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/ragEngineConfig -d "{'ragManagedDbConfig': {'serverless': {}}}"
Python
from vertexai.preview import rag
import vertexai
PROJECT_ID = YOUR_PROJECT_ID
LOCATION = YOUR_RAG_ENGINE_LOCATION
# Initialize Agent Platform API once per session
vertexai.init(project=PROJECT_ID, location=LOCATION)
rag_engine_config_name=f"projects/{PROJECT_ID}/locations/{LOCATION}/ragEngineConfig"
new_rag_engine_config = rag.RagEngineConfig(
name=rag_engine_config_name,
rag_managed_db_config=rag.RagManagedDbConfig(mode=rag.Serverless()),
)
updated_rag_engine_config = rag.rag_data.update_rag_engine_config(
rag_engine_config=new_rag_engine_config
)
print(updated_rag_engine_config)
מעבר למצב Spanner
דוגמאות הקוד הבאות מראות איך לעבור למצב Spanner ב-RagEngineConfig. אם השתמשתם בעבר במצב Spanner ובחרתם רמת שירות, אתם לא צריכים לציין אותה במפורש כשאתם עוברים למצב הזה. אם לא, בדוגמאות הקוד שבהמשך מוסבר איך לעבור למצב Spanner תוך ציון רמת שירות.
המסוף
- נכנסים לדף RAG Engine במסוף Google Cloud .
- בוחרים את האזור שבו מנוע ה-RAG פועל.
- לוחצים על האפשרות מעבר ל-Spanner. יכול להיות שהאפשרות לא תופיע אם אתם במצב Spanner. אפשר לראות את המצב הנוכחי בתווית המצב.
REST
PROJECT_ID: Your project ID.
LOCATION: The region to process the request.
curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/ragEngineConfig -d "{'ragManagedDbConfig': {'spanner': {}}}"
Python
from vertexai.preview import rag
import vertexai
PROJECT_ID = YOUR_PROJECT_ID
LOCATION = YOUR_RAG_ENGINE_LOCATION
# Initialize Agent Platform API once per session
vertexai.init(project=PROJECT_ID, location=LOCATION)
rag_engine_config_name=f"projects/{PROJECT_ID}/locations/{LOCATION}/ragEngineConfig"
new_rag_engine_config = rag.RagEngineConfig(
name=rag_engine_config_name,
rag_managed_db_config=rag.RagManagedDbConfig(mode=rag.Spanner()),
)
updated_rag_engine_config = rag.rag_data.update_rag_engine_config(
rag_engine_config=new_rag_engine_config
)
print(updated_rag_engine_config)
קריאה של RagEngineConfig הנוכחי
בדוגמאות הקוד הבאות אפשר לראות איך קוראים את RagEngineConfig כדי לדעת איזה מצב ואיזו רמה נבחרו:
REST
PROJECT_ID: Your project ID.
LOCATION: The region to process the request.
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/ragEngineConfig
Python
from vertexai.preview import rag
import vertexai
PROJECT_ID = YOUR_PROJECT_ID
LOCATION = YOUR_RAG_ENGINE_LOCATION
# Initialize Agent Platform API once per session
vertexai.init(project=PROJECT_ID, location=LOCATION)
rag_engine_config = rag.rag_data.get_rag_engine_config(
name=f"projects/{PROJECT_ID}/locations/{LOCATION}/ragEngineConfig"
)
print(rag_engine_config)
עדכון המסלול במצב Spanner
בדוגמאות הקוד הבאות אפשר לראות איך מעדכנים את הרמה במצב Spanner:
עדכון של RagEngineConfig למצב Spanner, רמת Scaled
בדוגמאות הקוד הבאות אפשר לראות איך מגדירים את RagEngineConfig למצב Spanner עם רמת מחיר מותאמת:
המסוף
- נכנסים לדף RAG Engine במסוף Google Cloud .
- בוחרים את האזור שבו מנוע ה-RAG פועל.
- לוחצים על האפשרות Switch to Spanner (מעבר ל-Spanner), אם עדיין לא נמצאים במצב Spanner.
- לוחצים על Configure RAG Engine (הגדרת מנוע RAG). מופיעה החלונית Configure RAG Engine.
- בוחרים את הרמה שבה רוצים להפעיל את מנוע ה-RAG.
- לוחצים על Save.
REST
PROJECT_ID: Your project ID.
LOCATION: The region to process the request.
curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/ragEngineConfig -d "{'ragManagedDbConfig': {'spanner': {'scaled': {}}}}"
Python
from vertexai.preview import rag
import vertexai
PROJECT_ID = YOUR_PROJECT_ID
LOCATION = YOUR_RAG_ENGINE_LOCATION
# Initialize Agent Platform API once per session
vertexai.init(project=PROJECT_ID, location=LOCATION)
rag_engine_config_name=f"projects/{PROJECT_ID}/locations/{LOCATION}/ragEngineConfig"
new_rag_engine_config = rag.RagEngineConfig(
name=rag_engine_config_name,
rag_managed_db_config=rag.RagManagedDbConfig(mode=rag.Spanner(tier=rag.Scaled())),
)
updated_rag_engine_config = rag.rag_data.update_rag_engine_config(
rag_engine_config=new_rag_engine_config
)
print(updated_rag_engine_config)
עדכון של RagEngineConfig למצב Spanner עם רמת שירות Basic
בדוגמאות הקוד הבאות אפשר לראות איך מגדירים את RagEngineConfig למצב Spanner עם רמת שירות Basic:
המסוף
- נכנסים לדף RAG Engine במסוף Google Cloud .
- בוחרים את האזור שבו מנוע ה-RAG פועל.
- לוחצים על האפשרות Switch to Spanner (מעבר ל-Spanner), אם עדיין לא נמצאים במצב Spanner.
- לוחצים על Configure RAG Engine (הגדרת מנוע RAG). מופיעה החלונית Configure RAG Engine.
- בוחרים את הרמה שבה רוצים להפעיל את מנוע ה-RAG.
- לוחצים על Save.
REST
PROJECT_ID: Your project ID.
LOCATION: The region to process the request.
curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/ragEngineConfig -d "{'ragManagedDbConfig': {'spanner': {'basic': {}}}}"
Python
from vertexai.preview import rag
import vertexai
PROJECT_ID = YOUR_PROJECT_ID
LOCATION = YOUR_RAG_ENGINE_LOCATION
# Initialize Agent Platform API once per session
vertexai.init(project=PROJECT_ID, location=LOCATION)
rag_engine_config_name=f"projects/{PROJECT_ID}/locations/{LOCATION}/ragEngineConfig"
new_rag_engine_config = rag.RagEngineConfig(
name=rag_engine_config_name,
rag_managed_db_config=rag.RagManagedDbConfig(mode=rag.Spanner(tier=rag.Basic())),
)
updated_rag_engine_config = rag.rag_data.update_rag_engine_config(
rag_engine_config=new_rag_engine_config
)
print(updated_rag_engine_config)
עדכון של RagEngineConfig לדרגת Unprovisioned
דוגמאות הקוד הבאות מדגימות איך להגדיר את RagEngineConfig למצב Spanner עם רמת שירות ללא הקצאת משאבים. פעולה כזו תמחק באופן סופי את כל הנתונים ממצב הפריסה של Spanner ותפסיק את הוצאות החיוב שנובעות ממנו.
המסוף
- נכנסים לדף RAG Engine במסוף Google Cloud .
- בוחרים את האזור שבו מנוע ה-RAG פועל.
- לוחצים על האפשרות Switch to Spanner (מעבר ל-Spanner), אם עדיין לא נמצאים במצב Spanner.
- לוחצים על מחיקת מנוע RAG. מופיעה תיבת דו-שיח לאישור.
- כדי לוודא שאתם עומדים למחוק את הנתונים במנוע RAG, מזינים delete.
- לוחצים על אישור.
- לוחצים על Save.
REST
PROJECT_ID: Your project ID.
LOCATION: The region to process the request.
curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/ragEngineConfig -d "{'ragManagedDbConfig': {'spanner': {'unprovisioned': {}}}}"
Python
from vertexai.preview import rag
import vertexai
PROJECT_ID = YOUR_PROJECT_ID
LOCATION = YOUR_RAG_ENGINE_LOCATION
# Initialize Agent Platform API once per session
vertexai.init(project=PROJECT_ID, location=LOCATION)
rag_engine_config_name=f"projects/{PROJECT_ID}/locations/{LOCATION}/ragEngineConfig"
new_rag_engine_config = rag.RagEngineConfig(
name=rag_engine_config_name,
rag_managed_db_config=rag.RagManagedDbConfig(mode=rag.Spanner(tier=rag.Unprovisioned())),
)
updated_rag_engine_config = rag.rag_data.update_rag_engine_config(
rag_engine_config=new_rag_engine_config
)
print(updated_rag_engine_config)