במדריך הזה מוסבר איך ליצור, לעדכן ולנהל מיומנויות במאגר המיומנויות באמצעות ה-API בארכיטקטורת REST.
לפני שמתחילים
לפני שמשתמשים ב-Skill Registry, צריך להגדיר את הסביבה:
- נכנסים לחשבון 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 Gemini Enterprise 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.-
Make sure that you have the following role or roles on the project:
roles/aiplatform.viewerorroles/aiplatform.user,roles/serviceusage.serviceUsageConsumerCheck 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 Gemini Enterprise 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.-
Make sure that you have the following role or roles on the project:
roles/aiplatform.viewerorroles/aiplatform.user,roles/serviceusage.serviceUsageConsumerCheck 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.
-
תאימות
בטבלה הבאה מפורטים סטטוסי התאימות:
| תכונה | סטטוס |
|---|---|
| Access Transparency | נתמך |
| מיקום אחסון הנתונים (DRZ) בארה"ב ובאיחוד האירופי | נתמך |
| מפתחות הצפנה בניהול הלקוח (CMEK) | לא נתמך |
| אישור HIPAA | לא נתמך |
| VPC-SC | לא נתמך |
אזורים זמינים
Skill Registry זמין באזורים הבאים:
| אזור | מיקום |
|---|---|
us-central1 |
איווה |
europe-west4 |
הולנד |
us-east5 |
קולומבוס, אוהיו |
יצירת מיומנות
כדי ליצור מיומנות חדשה, משתמשים ב-method CreateSkill. הפעולה הזו היא פעולה ממושכת.
דוגמאות למבנה המיומנות הצפוי מופיעות בקובצי SKILL.md במאגר המיומנויות של Google Cloud.
REST
בקטעים הבאים מוסבר איך להשתמש ב-API בארכיטקטורת REST כדי ליצור מיומנות.
הכנת המטען הייעודי (payload)
לפני שקוראים ל-API, צריך לארוז את קובצי המיומנות בארכיון ZIP ולקודד אותו למחרוזת base64 בשורה אחת. כדי להכין את המטען הייעודי (payload), פועלים לפי השלבים הבאים:
עוברים לספריית הסקילים:
cd <SKILL_DIRECTORY>יוצרים את ארכיון ה-ZIP ומקודדים אותו ל-base64.
לדוגמה:
zip -r skill.zip scripts/ references/ SKILL.md assets/ && base64 -w 0 -i skill.zip
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
LOCATION: האזור של המיומנות. מידע נוסף זמין במאמר אזורים זמינים.
SKILL_ID: הערך של
SKILL_IDלא ניתן לשינוי ונשאר שמור באופן קבוע אחרי שיוצרים אותו, גם אם מוחקים את המיומנות מאוחר יותר. מזהי המיומנויות חייבים לעמוד במגבלות הבאות:- השם צריך להיות באורך של 1 עד 63 תווים.
- השם יכול להכיל רק אותיות קטנות, מספרים ומקפים.
- הוא צריך להתחיל באות ולהסתיים באות או במספר.
- השם לא יכול להתחיל ב-
gcp-(הקידומת הזו שמורה לסקילים מובנים).
DISPLAY_NAME: שם המיומנות שבה משתמש הנציג. השיטה
RetrieveSkillsמשתמשת בשם המוצג ובתיאור כדי לחפש מיומנויות רלוונטיות.DESCRIPTION: תיאור של מה שהמיומנות עושה.
BASE64_ZIPPED_BODY: התוכן בקידוד base64 של ארכיון המיומנות הדחוס.
שיטת ה-HTTP וכתובת ה-URL
POST https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills?skillId=SKILL_ID
גוף בקשת JSON
{
"displayName": "DISPLAY_NAME",
"description": "DESCRIPTION",
"zippedFilesystem": "BASE64_ZIPPED_BODY"
}
הפקודה curl
curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json" \
-d '{
"displayName": "DISPLAY_NAME",
"description": "DESCRIPTION",
"zippedFilesystem": "BASE64_ZIPPED_BODY"
}' \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills?skillId=SKILL_ID"
Python
מארגנים את קובצי המיומנות (כמו SKILL.md, הוראות וקובצי קוד) בספרייה מקומית. ה-SDK תומך בהעברה של נתיב לספרייה מקומית (שנדחסת באופן אוטומטי) או נתיב לקובץ ZIP.
ב-google-cloud-aiplatform (שמספק את agentplatform) בגרסה 1.154.0 ואילך:
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
skill = client.skills.create(
skill_id="SKILL_ID",
display_name="DISPLAY_NAME",
description="DESCRIPTION",
config={
# Local directory path (automatically compressed) or pre-zipped path (.zip)
"local_path": "SKILL_PATH",
},
)
print(skill.name)
בגרסאות של google-cloud-aiplatform (שמספק את agentplatform) שקודמות ל-1.154.0:
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
skill = client.skills.create(
display_name="DISPLAY_NAME",
description="DESCRIPTION",
config={
"skill_id": "SKILL_ID",
# Local directory path (automatically compressed) or pre-zipped path (.zip)
"local_path": "SKILL_PATH",
},
)
print(skill.name)
Node.js
מארגנים את קובצי המיומנות (כמו SKILL.md, הוראות וקובצי קוד) בספרייה מקומית. ה-SDK תומך בהעברה של נתיב לספרייה מקומית (שנדחסת באופן אוטומטי) או של נתיב לקובץ שכבר דחוס.
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
const skill = await client.skills.create({
skillId: 'SKILL_ID',
displayName: 'DISPLAY_NAME',
description: 'DESCRIPTION',
config: {
// Local directory path (automatically compressed) or pre-zipped path (.zip)
localPath: 'SKILL_PATH',
},
});
console.log(skill.name);
עדכון סקיל
כדי לעדכן מיומנות קיימת, משתמשים ב-method UpdateSkill. הפעולה הזו היא פעולה ממושכת.
אתם יכולים לעדכן את השם המוצג, התיאור והמטען הייעודי (מערכת קבצים מכווצת) של מיומנות קיימת. רק השדות שמופיעים בפרמטר השאילתה updateMask מתעדכנים.
REST
בקטעים הבאים מוסבר איך משתמשים ב-API בארכיטקטורת REST כדי לעדכן מיומנות.
הכנת המטען הייעודי (payload)
זה שינוי אופציונלי. אם אתם מעדכנים את קובצי המיומנות, אתם צריכים לארוז את קובצי המיומנות המעודכנים בארכיון ZIP ולקודד אותו למחרוזת base64 בשורה אחת:
עוברים לספריית הסקילים:
cd <SKILL_DIRECTORY>יוצרים את ארכיון ה-ZIP ומקודדים אותו ל-base64:
zip -r skill.zip scripts/ references/ SKILL.md assets/ && base64 -w 0 -i skill.zip
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור של המיומנות. מידע נוסף זמין במאמר אזורים זמינים.
- SKILL_ID: המזהה של המיומנות שרוצים לעדכן.
- DISPLAY_NAME: אופציונלי. שם חדש למיומנות.
- DESCRIPTION: אופציונלי. תיאור חדש של מה שהמיומנות עושה.
- BASE64_ZIPPED_BODY: אופציונלי. התוכן בקידוד base64 של ארכיון הסקיל המעודכן בקובץ ZIP.
שיטת ה-HTTP וכתובת ה-URL
PATCH https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID
גוף בקשת JSON
{
"displayName": "DISPLAY_NAME",
"description": "DESCRIPTION",
"zippedFilesystem": "BASE64_ZIPPED_BODY"
}
הפקודה curl
הפקודה הבאה של curl מעדכנת את השם המוצג, התיאור וקובץ המיומנות המכווץ.
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{
"displayName": "DISPLAY_NAME",
"description": "DESCRIPTION",
"zippedFilesystem": "BASE64_ZIPPED_BODY"
}' \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID?updateMask=displayName,description,zippedFilesystem"
Python
ה-SDK תומך בעדכון קובצי הסקילים על ידי העברת נתיב של ספרייה מקומית לא מכווצת או נתיב מכווץ מראש.
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
skill = client.skills.update(
name="projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID",
config={
"display_name": "DISPLAY_NAME",
"description": "DESCRIPTION",
# Optional. Local directory path (automatically compressed) or pre-zipped path (.zip)
"local_path": "SKILL_PATH",
},
)
print(skill.name)
Node.js
ה-SDK תומך בעדכון קובצי המיומנות על ידי העברת נתיב של ספרייה מקומית לא מכווצת או נתיב מכווץ מראש.
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
const skill = await client.skills.update({
name: 'projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID',
config: {
displayName: 'DISPLAY_NAME',
description: 'DESCRIPTION',
// Optional. Local directory path (automatically compressed) or pre-zipped path (.zip)
localPath: 'SKILL_PATH',
},
});
console.log(skill.name);
פירוט של רשימת המיומנויות
כדי לאחזר מטא-נתונים של סיכום למיומנויות במיקום ספציפי (כולל השם, השם המוצג והתיאור), משתמשים ב-method ListSkills.
REST
בקטעים הבאים מוסבר איך להשתמש ב-API בארכיטקטורת REST כדי להציג רשימה של מיומנויות.
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור של המיומנויות שרוצים להציג. מידע נוסף זמין במאמר אזורים זמינים.
שיטת ה-HTTP וכתובת ה-URL
GET https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills
הפקודה curl
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills"
פלט לדוגמה
{
"name": "projects/1234567890/locations/us-central1/skills/3456789012",
"createTime": "2026-05-10T00:02:12.497720Z",
"updateTime": "2026-05-10T00:02:19.064874Z",
"displayName": "cymbal_skill",
"description": "A skill for managing Cymbal projects.",
"state": "ACTIVE"
}
Python
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
pager = client.skills.list()
for skill in pager:
print(skill.name, skill.display_name)
Node.js
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
const pager = await client.skills.list();
for await (const skill of pager) {
console.log(skill.name, skill.displayName);
}
הוספת מיומנות
כדי לאחזר את המטא-נתונים והמטען הייעודי (payload) של הגרסה האחרונה של מיומנות, משתמשים ב-method GetSkill.
REST
בקטעים הבאים מוסבר איך להשתמש ב-API בארכיטקטורת REST כדי לקבל מיומנות.
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור שבו נמצאות המיומנויות. מידע נוסף זמין במאמר אזורים זמינים.
- SKILL_ID: המזהה של המיומנות שרוצים לאחזר.
שיטת ה-HTTP וכתובת ה-URL
GET https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID
הפקודה curl
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID"
Python
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
skill = client.skills.get(
name="projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID"
)
print(skill)
Node.js
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
const skill = await client.skills.get({
name: 'projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID',
});
console.log(skill);
מחיקת מיומנות
כדי למחוק מיומנות ואת כל הגרסאות שלה, משתמשים ב-method DeleteSkill.
הפעולה הזו היא פעולה ממושכת.
REST
בקטעים הבאים מוסבר איך משתמשים ב-API בארכיטקטורת REST כדי למחוק מיומנות.
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור שבו נמצא הסקיל שרוצים למחוק. מידע נוסף זמין במאמר אזורים זמינים.
- SKILL_ID: המזהה של המיומנות שרוצים למחוק.
שיטת ה-HTTP וכתובת ה-URL
DELETE https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID
הפקודה curl
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID"
Python
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
client.skills.delete(
name="projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID"
)
Node.js
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
await client.skills.delete({
name: 'projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID',
});
הצגת רשימת הגרסאות של הסקיל
כדי לאחזר את היסטוריית הגרסאות של מיומנות ספציפית, משתמשים ב-method ListSkillRevisions.
REST
בקטעים הבאים מוסבר איך להשתמש ב-API בארכיטקטורת REST כדי להציג רשימה של גרסאות המיומנות.
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור שבו נמצאות המיומנויות שאתם רוצים. מידע נוסף זמין במאמר אזורים זמינים.
- SKILL_ID: מזהה המיומנות.
שיטת ה-HTTP וכתובת ה-URL
GET https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID/revisions
הפקודה curl
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID/revisions"
פלט לדוגמה
{
"skillRevisions": [
{
"name": "projects/1234567890/locations/us-central1/skills/cymbal_skill/revisions/4567890123",
"createTime": "2026-05-10T00:02:12.497720Z",
"updateTime": "2026-05-10T00:02:19.064874Z"
}
]
}
Python
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
response = client.skills.revisions.list(
name="projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID"
)
for skill_revision in response.skill_revisions:
print(skill_revision.name, skill_revision.create_time)
Node.js
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
const response = await client.skills.revisions.list({
name: 'projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID',
});
for (const revision of response.skillRevisions || []) {
console.log(revision.name, revision.createTime);
}
קבלת גרסה של סקיל
כדי לאחזר גרסה ספציפית של מיומנות, משתמשים ב-method GetSkillRevision.
REST
בקטעים הבאים מוסבר איך משתמשים ב-API בארכיטקטורת REST כדי לקבל גרסה של מיומנות.
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור של המיומנות. מידע נוסף זמין במאמר אזורים זמינים.
- SKILL_ID: מזהה המיומנות.
- REVISION_ID: המזהה של הגרסה הספציפית שרוצים לאחזר. אפשר למצוא את המזהה בשדה
nameשמוחזר על ידי ה-methodListSkillRevisions. לדוגמה, אם הערך שלnameהואprojects/1234567890/locations/us-central1/skills/cymbal-skill/revisions/4567890123, מזהה הגרסה הוא4567890123.
שיטת ה-HTTP וכתובת ה-URL
GET https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID/revisions/REVISION_ID
הפקודה curl
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID/revisions/REVISION_ID"
Python
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
revision = client.skills.revisions.get(
name="projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID/revisions/REVISION_ID"
)
print(revision)
Node.js
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
const revision = await client.skills.revisions.get({
name: 'projects/PROJECT_ID/locations/LOCATION/skills/SKILL_ID/revisions/REVISION_ID',
});
console.log(revision);
אחזור מיומנויות
משתמשים ב-RetrieveSkills כדי למצוא מיומנויות באמצעות חיפוש סמנטי. לדוגמה, כדי לחפש מיומנויות, אתם יכולים לתאר את המשימה שאתם רוצים לבצע, כמו find skills to manage cloud resources.
REST
בקטעים הבאים מוסבר איך להשתמש ב-API בארכיטקטורת REST כדי לאחזר מיומנויות.
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הערכים בשדות הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור שבו נמצאות המיומנויות שרוצים לחפש. מידע נוסף זמין במאמר אזורים זמינים.
- QUERY: מחרוזת השאילתה למציאת מיומנויות תואמות.
שיטת ה-HTTP וכתובת ה-URL
GET https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills:retrieve?query=QUERY
הפקודה curl
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/skills:retrieve?query=QUERY"
Python
import agentplatform
client = agentplatform.Client(project="PROJECT_ID", location="LOCATION")
response = client.skills.retrieve(
query="QUERY",
config={"top_k": TOP_K},
)
for retrieved_skill in response.retrieved_skills:
print(retrieved_skill.skill_name, retrieved_skill.description)
Node.js
import { Client } from '@google-cloud/agentplatform';
const client = new Client({
project: 'PROJECT_ID',
location: 'LOCATION',
});
const response = await client.skills.retrieve({
query: 'QUERY',
config: {
topK: TOP_K,
},
});
for (const retrievedSkill of response.retrievedSkills || []) {
console.log(retrievedSkill.skillName, retrievedSkill.description);
}
קבלת פרטים על פעולה ממושכת
חלק מה-methods ב-Skill Registry API, כמו CreateSkill, UpdateSkill ו-DeleteSkill, הן אסינכרוניות ומחזירות פעולה ממושכת.
פעולה ממושכת היא דפוס API שמשמש לפעולות שיכולות להימשך זמן רב. במקום להמתין לסיום הפעולה, ה-API מחזיר משאב של פעולה.
התשובה מהשיטות האלה כוללת את השדה name, שמכיל את מזהה הפעולה. לדוגמה, name יכול להיראות כך:
projects/PROJECT_NUMBER/locations/LOCATION/skills/SKILL_ID/operations/OPERATION_ID.
כדי לבדוק את הסטטוס ולקבל פרטים על פעולה ממושכת, משתמשים ב-method GetOperation עם ה-OPERATION_ID שחולץ.
REST
בקטעים הבאים מוסבר איך להשתמש ב-API בארכיטקטורת REST כדי לקבל פעולה.
משתני בקשה
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- PROJECT_ID: מזהה הפרויקט ב- Google Cloud .
- LOCATION: האזור שבו הפעולה פועלת. האזור צריך להיות זהה לאזור שצוין בבקשה הראשונית. מידע נוסף זמין במאמר אזורים זמינים.
- OPERATION_ID: מזהה הפעולה. מחלצים את זה מהשדה
nameשמוחזר על ידיCreateSkill,UpdateSkillאוDeleteSkill.
שיטת ה-HTTP וכתובת ה-URL
GET https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/operations/OPERATION_ID
הפקודה curl
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://LOCATION-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/operations/OPERATION_ID"
המאמרים הבאים
הוספת מיומנויות לסוכן
איך לצרף מיומנויות רשומות כשיוצרים או מעדכנים סוכן באמצעות Managed Agents API ב-Agent Platform.