Method: projects.locations.collections.engines.sessions.addContextFile

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

בקשת HTTP

POST https://discoveryengine.googleapis.com/v1beta/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}:addContextFile

כתובת ה-URL כתובה בתחביר של gRPC Transcoding.

פרמטרים של נתיב

פרמטרים
name

string

חובה. שם המשאב של הסשן. פורמט: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}

אם מציינים את - כמזהה הסשן, נוצר סשן חדש עם מזהה שנוצר באופן אוטומטי.

גוף הבקשה

גוף הבקשה מכיל נתונים במבנה הבא:

ייצוג ב-JSON
{
  "fileName": string,
  "mimeType": string,

  // Union field file can be only one of the following:
  "fileContents": string
  // End of list of possible types for union field file.
}
שדות
fileName

string

חובה. שם הקובץ.

mimeType

string

זה שינוי אופציונלי. סוג התוכן של הקובץ, אפשר לעיין בכתובת https://www.iana.org/assignments/media-types/media-types.xhtml.

השדה הזה נדרש אם מקור הנתונים לא מספק את סוג התוכן.

שדה איחוד file. התוכן של הקובץ. הערך file יכול להיות רק אחד מהבאים:
fileContents

string (bytes format)

תוכן הקובץ מוצג בתוך הטקסט.

מחרוזת בקידוד Base64.

גוף התשובה

תשובה לשיטה AssistantService.AddContextFile.

אם הפעולה בוצעה ללא שגיאות, גוף התגובה יכיל נתונים במבנה הבא:

ייצוג ב-JSON
{
  "session": string,
  "fileId": string,
  "tokenCount": string
}
שדות
session

string

שם הסשן, השם שצוין או השם החדש שנוצר.

פורמט: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}

fileId

string

המזהה של הקובץ שהועלה.

tokenCount
(deprecated)

string (int64 format)

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

אורך הקובץ שנמדד בטוקנים.

היקפי הרשאות

נדרש אחד מהיקפי ההרשאות הבאים של OAuth:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/discoveryengine.readwrite
  • https://www.googleapis.com/auth/discoveryengine.assist.readwrite

ניתן למצוא מידע נוסף כאן: Authentication Overview.

הרשאות IAM

נדרשת הרשאת IAM הבאה במשאב name:

  • discoveryengine.sessions.addContextFile

מידע נוסף מופיע במאמרי העזרה בנושא IAM.