יצירה וניהול של מיומנויות

במדריך הזה מוסבר איך ליצור, לעדכן ולנהל מיומנויות במאגר המיומנויות באמצעות ה-API בארכיטקטורת REST.

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

לפני שמשתמשים ב-Skill Registry, צריך להגדיר את הסביבה:

  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 Gemini Enterprise 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. Make sure that you have the following role or roles on the project: roles/aiplatform.viewer or roles/aiplatform.user, roles/serviceusage.serviceUsageConsumer

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  6. 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

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

  8. 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.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

  9. Make sure that you have the following role or roles on the project: roles/aiplatform.viewer or roles/aiplatform.user, roles/serviceusage.serviceUsageConsumer

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. 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), פועלים לפי השלבים הבאים:

  1. עוברים לספריית הסקילים:

    cd <SKILL_DIRECTORY>
    
  2. יוצרים את ארכיון ה-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 בשורה אחת:

  1. עוברים לספריית הסקילים:

    cd <SKILL_DIRECTORY>
    
  2. יוצרים את ארכיון ה-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 שמוחזר על ידי ה-method‏ ListSkillRevisions. לדוגמה, אם הערך של 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.

מדריך

איך משלבים את Skill Registry ב-ADK.