Gemini API תומך ביצירת תוכן באמצעות תמונות, אודיו, קוד, כלים ועוד. כדי לקבל פרטים על כל אחת מהתכונות האלה, כדאי לקרוא את הקוד לדוגמה, לקרוא את המדריכים המקיפים ולעיין בהם.
שיטה: models.generateContent
יוצרת תשובה למודל בהינתן קלט GenerateContentRequest
. כדי לקבל מידע מפורט על השימוש, אפשר לעיין במדריך ליצירת טקסט. יכולות הקלט משתנות בין המודלים, כולל מודלים מכווננים. פרטים נוספים זמינים במדריך המודלים ובמדריך הכוונון.
נקודת קצה
לשלוח
https://generativelanguage.googleapis.com/v1beta/{model=models/*}:generateContent
פרמטרים של נתיב
model
string
חובה. השם של Model
שישמש ליצירת ההשלמה.
פורמט: name=models/{model}
הוא מופיע בפורמט models/{model}
.
גוף הבקשה
גוף הבקשה מכיל נתונים במבנה הבא:
contents[]
object (Content
)
חובה. תוכן השיחה הנוכחית עם המודל.
בשאילתות עם סיבוב אחד, מדובר באירוע יחיד. בשאילתות מרובות תורות כמו צ'אט, זהו שדה חוזר שמכיל את היסטוריית השיחות ואת הבקשה האחרונה.
tools[]
object (Tool
)
זה שינוי אופציונלי. רשימה של Tools
ש-Model
עשוי להשתמש בהם כדי ליצור את התשובה הבאה.
Tool
הוא קטע קוד שמאפשר למערכת לקיים אינטראקציה עם מערכות חיצוניות כדי לבצע פעולה או קבוצת פעולות, שלא במסגרת הידע וההיקף של Model
. סוגי Tool
הנתמכים הם Function
ו-codeExecution
. מידע נוסף זמין במדריכים קריאות לפונקציה והפעלת קוד.
toolConfig
object (ToolConfig
)
זה שינוי אופציונלי. הגדרת הכלי לכל Tool
שצוין בבקשה. דוגמה לשימוש זמינה במדריך להפעלת פונקציות.
safetySettings[]
object (SafetySetting
)
זה שינוי אופציונלי. רשימה של מופעים ייחודיים של SafetySetting
לחסימת תוכן לא בטוח.
המדיניות הזו תיאכף בGenerateContentRequest.contents
ובGenerateContentResponse.candidates
. לכל סוג של SafetyCategory
יכולה להיות הגדרה אחת לכל היותר. ה-API יחסום תוכן ותשובות שלא יעמדו בערכי הסף שהוגדרו על ידי ההגדרות האלה. הרשימה הזו מבטלת את הגדרות ברירת המחדל לכל SafetyCategory
שצוינו בהגדרות הבטיחות. אם לא צוין SafetySetting
עבור SafetyCategory
מסוים ברשימה, ה-API ישתמש בהגדרת ברירת המחדל של בטיחות לקטגוריה הזו. קיימת תמיכה בקטגוריות פגיעה HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT ו-HARM_CATEGORY_HARASSMENT. כדאי לעיין במדריך לקבלת מידע מפורט על הגדרות הבטיחות הזמינות. כדאי גם לעיין בהנחיות הבטיחות כדי ללמוד איך לשלב שיקולי בטיחות באפליקציות ה-AI.
systemInstruction
object (Content
)
זה שינוי אופציונלי. הוראות המערכת של המפתחים. כרגע אפשר להשתמש רק בטקסט.
generationConfig
object (GenerationConfig
)
זה שינוי אופציונלי. אפשרויות תצורה ליצירת מודל ולפלט שלו.
cachedContent
string
זה שינוי אופציונלי. שם התוכן שנשמר במטמון לשימוש כהקשר להצגת החיזוי. פורמט: cachedContents/{cachedContent}
דוגמה לבקשה
טקסט
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
תמונה
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
אודיו
Python
Node.js
קונכייה
וידאו
Python
Node.js
Go
קונכייה
Python
קונכייה
צ'אט
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
מטמון
Python
Node.js
מודל מכוונן
Python
מצב JSON
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
ביצוע קוד
Python
Kotlin
Java
שליחת פונקציות
Python
Node.js
קונכייה
Kotlin
Swift
Dart
Java
הגדרת היצירה
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
הגדרות בטיחות
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
הוראה למערכת
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
גוף התשובה
אם הפעולה בוצעה ללא שגיאות, גוף התגובה יכלול מופע של GenerateContentResponse
.
השיטה: models.streamGenerateContent
יוצרת תגובה בסטרימינג מהמודל בהינתן קלט GenerateContentRequest
.
נקודת קצה
לשלוח
https://generativelanguage.googleapis.com/v1beta/{model=models/*}:streamGenerateContent
פרמטרים של נתיב
model
string
חובה. השם של Model
שישמש ליצירת ההשלמה.
פורמט: name=models/{model}
הוא מופיע בפורמט models/{model}
.
גוף הבקשה
גוף הבקשה מכיל נתונים במבנה הבא:
contents[]
object (Content
)
חובה. תוכן השיחה הנוכחית עם המודל.
בשאילתות עם סיבוב אחד, מדובר באירוע יחיד. בשאילתות מרובות תורות כמו צ'אט, זהו שדה חוזר שמכיל את היסטוריית השיחות ואת הבקשה האחרונה.
tools[]
object (Tool
)
זה שינוי אופציונלי. רשימה של Tools
ש-Model
עשוי להשתמש בהם כדי ליצור את התשובה הבאה.
Tool
הוא קטע קוד שמאפשר למערכת לקיים אינטראקציה עם מערכות חיצוניות כדי לבצע פעולה או קבוצת פעולות, שלא במסגרת הידע וההיקף של Model
. סוגי Tool
הנתמכים הם Function
ו-codeExecution
. מידע נוסף זמין במדריכים קריאות לפונקציה והפעלת קוד.
toolConfig
object (ToolConfig
)
זה שינוי אופציונלי. הגדרת הכלי לכל Tool
שצוין בבקשה. דוגמה לשימוש זמינה במדריך להפעלת פונקציות.
safetySettings[]
object (SafetySetting
)
זה שינוי אופציונלי. רשימה של מופעים ייחודיים של SafetySetting
לחסימת תוכן לא בטוח.
המדיניות הזו תיאכף בGenerateContentRequest.contents
ובGenerateContentResponse.candidates
. לכל סוג של SafetyCategory
יכולה להיות הגדרה אחת לכל היותר. ה-API יחסום תוכן ותשובות שלא יעמדו בערכי הסף שהוגדרו על ידי ההגדרות האלה. הרשימה הזו מבטלת את הגדרות ברירת המחדל לכל SafetyCategory
שצוינו בהגדרות הבטיחות. אם לא צוין SafetySetting
עבור SafetyCategory
מסוים ברשימה, ה-API ישתמש בהגדרת ברירת המחדל של בטיחות לקטגוריה הזו. קיימת תמיכה בקטגוריות פגיעה HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT ו-HARM_CATEGORY_HARASSMENT. כדאי לעיין במדריך לקבלת מידע מפורט על הגדרות הבטיחות הזמינות. כדאי גם לעיין בהנחיות הבטיחות כדי ללמוד איך לשלב שיקולי בטיחות באפליקציות ה-AI.
systemInstruction
object (Content
)
זה שינוי אופציונלי. הוראות המערכת של המפתחים. כרגע אפשר להשתמש רק בטקסט.
generationConfig
object (GenerationConfig
)
זה שינוי אופציונלי. אפשרויות תצורה ליצירת מודל ולפלט שלו.
cachedContent
string
זה שינוי אופציונלי. שם התוכן שנשמר במטמון לשימוש כהקשר להצגת החיזוי. פורמט: cachedContents/{cachedContent}
דוגמה לבקשה
טקסט
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
תמונה
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
אודיו
Python
קונכייה
וידאו
Python
Node.js
Go
קונכייה
Python
קונכייה
צ'אט
Python
Node.js
Go
קונכייה
Kotlin
Swift
Dart
Java
גוף התשובה
אם הפעולה בוצעה ללא שגיאות, גוף התגובה יכלול זרם של GenerateContentResponse
מופעים.
GenerateContentResponse
תשובה מהמודל שתומכת במספר תשובות של מועמדים.
סיווגי הבטיחות וסינון התוכן מדווחים גם להנחיות בGenerateContentResponse.prompt_feedback
וגם לכל מועמד בfinishReason
ובsafetyRatings
. ה-API: - מחזיר את כל המועמדים המבוקשים או אף אחד מהם - מחזיר לא מועמדים בכלל רק אם הייתה בעיה בהנחיה (סמן promptFeedback
) - מדווח משוב על כל מועמד ב-finishReason
וב-safetyRatings
.
candidates[]
object (Candidate
)
התשובות של המועמדים מהמודל.
promptFeedback
object (PromptFeedback
)
מחזירה את המשוב של ההנחיה שקשורה למסנני התוכן.
usageMetadata
object (UsageMetadata
)
פלט בלבד. מטא-נתונים של בקשות הגנרציה שימוש באסימון.
ייצוג JSON |
---|
{ "candidates": [ { object ( |
PromptFeedback
קבוצת מטא-נתונים של המשוב שההנחיה שצוינה ב-GenerateContentRequest.content
.
blockReason
enum (BlockReason
)
זה שינוי אופציונלי. אם היא מוגדרת, ההנחיה נחסמה ולא מוחזרים מועמדים. תנסח מחדש את ההנחיה.
safetyRatings[]
object (SafetyRating
)
דירוגים של בטיחות ההצעה. לכל קטגוריה יש דירוג אחד לכל היותר.
ייצוג JSON |
---|
{ "blockReason": enum ( |
BlockReason
מציינת את הסיבה לחסימת ההנחיה.
טיפוסים בני מנייה (enum) | |
---|---|
BLOCK_REASON_UNSPECIFIED |
ערך ברירת המחדל. הערך הזה לא בשימוש. |
SAFETY |
ההנחיה נחסמה מטעמי בטיחות. צריך לבדוק את safetyRatings כדי להבין איזו קטגוריית בטיחות חסמה אותה. |
OTHER |
ההנחיה נחסמה בגלל סיבות לא ידועות. |
BLOCKLIST |
ההנחיה נחסמה בגלל המונחים שכלולים ברשימת החסימה של המונחים. |
PROHIBITED_CONTENT |
ההנחיה נחסמה עקב תוכן אסור. |
UsageMetadata
מטא-נתונים לגבי השימוש באסימון של בקשת הגנרציה.
promptTokenCount
integer
מספר האסימונים בהודעה. כשמוגדר cachedContent
, זה עדיין הגודל הכולל של ההנחיות האפקטיביות, כלומר כולל מספר האסימונים בתוכן שנשמר במטמון.
cachedContentTokenCount
integer
מספר האסימונים בקטע שנשמר במטמון של ההנחיה (התוכן שנשמר במטמון)
candidatesTokenCount
integer
המספר הכולל של האסימונים בכל התשובות האפשריות שנוצרו.
totalTokenCount
integer
מספר האסימונים הכולל לבקשת הגנרציה (הצעות + אפשרויות לתגובה).
ייצוג JSON |
---|
{ "promptTokenCount": integer, "cachedContentTokenCount": integer, "candidatesTokenCount": integer, "totalTokenCount": integer } |
מועמד
- ייצוג JSON
- FinishReason
- GroundingAttribution
- AttributionSourceId
- GroundingPassageId
- SemanticRetrieverChunk
המודל הרצוי לתשובות נוצר מהמודל.
content
object (Content
)
פלט בלבד. תוכן שנוצר שהוחזר מהמודל.
finishReason
enum (FinishReason
)
זה שינוי אופציונלי. פלט בלבד. הסיבה לכך שהמודל הפסיק ליצור אסימונים.
אם השדה ריק, המודל לא הפסיק ליצור אסימונים.
safetyRatings[]
object (SafetyRating
)
רשימת דירוגים לשמירה על הבטיחות של המועמדים לתשובות.
לכל קטגוריה יש דירוג אחד לכל היותר.
citationMetadata
object (CitationMetadata
)
פלט בלבד. ציטוטים ביבליוגרפיים של המועמדים שנוצרו על ידי המודל.
אפשר לאכלס את השדה הזה בפרטי הקראה עבור כל טקסט שנכלל ב-content
. אלה פסקאות ש"מצוטטות" מחומרים שמוגנים בזכויות יוצרים בנתוני האימון הבסיסיים של ה-LLM.
tokenCount
integer
פלט בלבד. מספר האסימונים למועמד הזה.
groundingAttributions[]
object (GroundingAttribution
)
פלט בלבד. פרטי שיוך (Attribution) למקורות שתרמו לתשובה מבוססת.
השדה הזה מאוכלס ב-GenerateAnswer
שיחות.
index
integer
פלט בלבד. אינדקס המועמד ברשימת המועמדים.
ייצוג JSON |
---|
{ "content": { object ( |
FinishReason
מגדיר את הסיבה לכך שהמודל הפסיק ליצור אסימונים.
טיפוסים בני מנייה (enum) | |
---|---|
FINISH_REASON_UNSPECIFIED |
ערך ברירת המחדל. הערך הזה לא בשימוש. |
STOP |
נקודת העצירה הטבעית של המודל או רצף העצירה שצוין. |
MAX_TOKENS |
הגעת למספר האסימונים המקסימלי שצוין בבקשה. |
SAFETY |
התוכן של המועמד בתשובה סומן מטעמי בטיחות. |
RECITATION |
התוכן של המועמד לתשובה סומן מסיבות של הקראה. |
LANGUAGE |
התוכן של המועמד לתשובה סומן כתוכן בשפה שאינה נתמכת. |
OTHER |
סיבה לא ידועה. |
BLOCKLIST |
יצירת האסימון הופסקה כי התוכן מכיל מונחים אסורים. |
PROHIBITED_CONTENT |
יצירת האסימון הופסקה בגלל שהכיל תוכן אסור. |
SPII |
יצירת האסימון הופסקה כי יכול להיות שהתוכן מכיל פרטים אישיים מזהים (SPII) רגישים. |
MALFORMED_FUNCTION_CALL |
הבקשה להפעלת הפונקציה שנוצרה על ידי המודל לא חוקית. |
GroundingAttribution
שיוך למקור שתרם לתשובה.
sourceId
object (AttributionSourceId
)
פלט בלבד. המזהה של המקור שתורם לשיוך הזה.
content
object (Content
)
תוכן המקור שממנו מורכב השיוך הזה.
ייצוג JSON |
---|
{ "sourceId": { object ( |
AttributionSourceId
המזהה של המקור שתורם לשיוך הזה.
שדה איחוד source
.
source
יכול להיות רק אחת מהאפשרויות הבאות:
groundingPassage
object (GroundingPassageId
)
מזהה של פסקה בתוך השורה.
semanticRetrieverChunk
object (SemanticRetrieverChunk
)
מזהה של Chunk
שאוחזר באמצעות שליפה סמנטית.
ייצוג JSON |
---|
{ // Union field |
GroundingPassageId
מזהה של חלק בתוך GroundingPassage
.
passageId
string
פלט בלבד. מזהה של הקטע שתואם לערך GroundingPassage.id
של GenerateAnswerRequest
.
partIndex
integer
פלט בלבד. אינדקס החלק בתוך GroundingPassage.content
של GenerateAnswerRequest
.
ייצוג JSON |
---|
{ "passageId": string, "partIndex": integer } |
SemanticRetrieverChunk
מזהה של Chunk
שאוחזר באמצעות הכלי האחזור הסמנטי שצוין ב-GenerateAnswerRequest
באמצעות SemanticRetrieverConfig
.
source
string
פלט בלבד. שם המקור שתואם ל-SemanticRetrieverConfig.source
של הבקשה. לדוגמה: corpora/123
או corpora/123/documents/abc
chunk
string
פלט בלבד. השם של Chunk
שמכיל את הטקסט המשויך. לדוגמה: corpora/123/documents/abc/chunks/xyz
ייצוג JSON |
---|
{ "source": string, "chunk": string } |
CitationMetadata
אוסף של פרטי ייחוס של מקורות לחלק מהתוכן.
citationSources[]
object (CitationSource
)
ציטוטים למקורות עם תשובה ספציפית.
ייצוג JSON |
---|
{
"citationSources": [
{
object ( |
CitationSource
ציטוט אל מקור עבור חלק מתשובה ספציפית.
startIndex
integer
זה שינוי אופציונלי. תחילת המקטע של התגובה שמשויכת למקור הזה.
האינדקס מציין את תחילת הקטע, הנמדד בבייטים.
endIndex
integer
זה שינוי אופציונלי. סוף הפלח המשויך, לא כולל.
uri
string
זה שינוי אופציונלי. URI שמשויך כמקור של חלק מהטקסט.
license
string
זה שינוי אופציונלי. רישיון לפרויקט ב-GitHub שמשויך כמקור לפילוח.
כדי לשלוח ציטוטים של קוד, נדרשים פרטי רישיון.
ייצוג JSON |
---|
{ "startIndex": integer, "endIndex": integer, "uri": string, "license": string } |
GenerationConfig
אפשרויות תצורה ליצירת מודל ולפלט שלו. לא כל הפרמטרים ניתנים להגדרה בכל מודל.
stopSequences[]
string
זה שינוי אופציונלי. הקבוצה של רצפי תווים (עד 5) שיפסיקו ליצור פלט. אם צוין, ה-API יפסיק להופיע במראה הראשון של stop_sequence
. רצף העצירה לא ייכלל כחלק מהתשובה.
responseMimeType
string
זה שינוי אופציונלי. סוג MIME של הטקסט המבוקש שנוצר. סוגי ה-MIME הנתמכים הם: text/plain
: (ברירת מחדל) פלט טקסט. application/json
: תגובת JSON בתשובות האפשריות. במסמכים תמצאו רשימה של כל סוגי ה-MIME הנתמכים של הטקסט.
responseSchema
object (Schema
)
זה שינוי אופציונלי. סכימת פלט של הטקסט המועמד שנוצר. סכימות חייבות להיות קבוצת משנה של סכימת OpenAPI ויכולות להיות אובייקטים, פרימיטיבים או מערכים.
אם המדיניות מוגדרת, צריך להגדיר גם responseMimeType
תואם. סוגי MIME תואמים: application/json
: סכימה לתגובת JSON. פרטים נוספים זמינים במדריך ליצירת טקסט בפורמט JSON.
candidateCount
integer
זה שינוי אופציונלי. מספר התגובות שנוצרו להחזרה.
נכון לעכשיו, אפשר להגדיר את הערך הזה רק כ-1. אם המדיניות לא מוגדרת, ברירת המחדל תהיה 1.
maxOutputTokens
integer
זה שינוי אופציונלי. המספר המקסימלי של אסימונים שאפשר לכלול במועמד לתשובה.
הערה: ערך ברירת המחדל משתנה בהתאם למודל. כדאי לעיין במאפיין Model.output_token_limit
של Model
שמוחזר מהפונקציה getModel
.
temperature
number
זה שינוי אופציונלי. המדיניות קובעת את רמת הרנדומיזציה של הפלט.
הערה: ערך ברירת המחדל משתנה בהתאם למודל. כדאי לעיין במאפיין Model.temperature
של Model
שמוחזר מהפונקציה getModel
.
הערכים יכולים לנוע בין [0.0, 2.0].
topP
number
זה שינוי אופציונלי. ההסתברות המצטברת המקסימלית של אסימונים שיש להביא בחשבון במהלך הדגימה.
המודל משתמש בדגימה משולבת של הטקסטים העליונים (Top-k) ו-Top-p (גרעין).
האסימונים ממוינים לפי ההסתברויות שהוקצו להם, כך שהמערכת תתייחס רק לאסימונים עם הסיכוי הכי גבוה. דגימה מסוג 'אליפות גבוהה' מגבילה באופן ישיר את המספר המקסימלי של האסימונים שצריך להשתמש בהם, ואילו דגימת ה-Nucleus מגבילה את מספר האסימונים על סמך ההסתברות המצטברת.
הערה: ערך ברירת המחדל משתנה בהתאם ל-Model
והוא מצוין באמצעות המאפיין Model.top_p
שמוחזר מהפונקציה getModel
. מאפיין topK
ריק מציין שהמודל לא מיישם דגימות מובילות של k ולא מאפשר להגדיר את topK
בבקשות.
topK
integer
זה שינוי אופציונלי. המספר המקסימלי של אסימונים שצריך לקחת בחשבון במהלך הדגימה.
המודלים של Gemini מבוססים על דגימת נתונים מסוג Top-p (גרעין) או בשילוב של דגימות מובילות (Top-K) ודגימת גרעין. דגימת הדגלים מבוססת על סט של topK
האסימונים בעלי הסבירות הגבוהה ביותר. מודלים שפועלים עם דגימת גרעין לא מאפשרים הגדרה של topK.
הערה: ערך ברירת המחדל משתנה בהתאם ל-Model
והוא מצוין באמצעות המאפיין Model.top_p
שמוחזר מהפונקציה getModel
. מאפיין topK
ריק מציין שהמודל לא מיישם דגימות מובילות של k ולא מאפשר להגדיר את topK
בבקשות.
ייצוג JSON |
---|
{
"stopSequences": [
string
],
"responseMimeType": string,
"responseSchema": {
object ( |
HarmCategory
הקטגוריה של הדירוג.
הקטגוריות האלה כוללות סוגים שונים של נזקים שייתכן שמפתחים ירצו להתאים.
טיפוסים בני מנייה (enum) | |
---|---|
HARM_CATEGORY_UNSPECIFIED |
לא צוינה קטגוריה. |
HARM_CATEGORY_DEROGATORY |
תגובות שליליות או מזיקות שמטרגטות את הזהות או את המאפיין המוגן. |
HARM_CATEGORY_TOXICITY |
תוכן בוטה, לא מכבד או גס. |
HARM_CATEGORY_VIOLENCE |
תיאורים של תרחישים שבהם מוצגת אלימות כלפי אדם או קבוצה, או תיאורים כלליים של שפיכות דמים. |
HARM_CATEGORY_SEXUAL |
כולל התייחסות למעשים מיניים או לתוכן גס אחר. |
HARM_CATEGORY_MEDICAL |
עידוד של ייעוץ רפואי לא מאומת. |
HARM_CATEGORY_DANGEROUS |
תוכן מסוכן שמקדם גרימת נזק, מעודד גרימת נזק או עוזר לבצע פעולות מזיקות. |
HARM_CATEGORY_HARASSMENT |
תוכן שמטרתו הטרדה. |
HARM_CATEGORY_HATE_SPEECH |
דברי שטנה ותוכן. |
HARM_CATEGORY_SEXUALLY_EXPLICIT |
תוכן מיני בוטה. |
HARM_CATEGORY_DANGEROUS_CONTENT |
תוכן מסוכן. |
SafetyRating
דירוג הבטיחות של קטע התוכן.
דירוג הבטיחות כולל את הקטגוריה של הפגיעה ואת רמת ההסתברות לפגיעה בקטגוריה הזו עבור קטע תוכן. התוכן מסווג בתור בטיחות בכמה קטגוריות של פגיעה, וההסתברות לסיווג הנזק כוללת כאן.
category
enum (HarmCategory
)
חובה. הקטגוריה של הדירוג הזה.
probability
enum (HarmProbability
)
חובה. הסבירות לפגיעה בתוכן הזה.
blocked
boolean
האם התוכן הזה נחסם בגלל הסיווג הזה?
ייצוג JSON |
---|
{ "category": enum ( |
HarmProbability
הסבירות שקטע תוכן מסוים מזיק.
מערכת הסיווג מספקת את הסבירות שהתוכן לא בטוח. העובדה הזו לא מצביעה על חומרת הפגיעה בקטע תוכן.
טיפוסים בני מנייה (enum) | |
---|---|
HARM_PROBABILITY_UNSPECIFIED |
לא צוינה הסתברות. |
NEGLIGIBLE |
יש סיכוי זניח שהתוכן יהיה לא בטוח. |
LOW |
יש סיכוי נמוך שהתוכן יהיה לא בטוח. |
MEDIUM |
יש סיכוי בינוני שהתוכן יהיה לא בטוח. |
HIGH |
יש סיכוי גבוה שהתוכן יהיה לא בטוח. |
SafetySetting
הגדרת הבטיחות, שמשפיעה על ההתנהגות של חסימת הבטיחות.
העברה של הגדרת בטיחות לקטגוריה משנה את הסבירות שהתוכן ייחסם.
category
enum (HarmCategory
)
חובה. הקטגוריה של ההגדרה הזו.
threshold
enum (HarmBlockThreshold
)
חובה. קובעת את סף ההסתברות שבו הנזק נחסם.
ייצוג JSON |
---|
{ "category": enum ( |
HarmBlockThreshold
חסימה לפי הסבירות לפגיעה מסוימת, ומעבר לה.
טיפוסים בני מנייה (enum) | |
---|---|
HARM_BLOCK_THRESHOLD_UNSPECIFIED |
לא צוין סף. |
BLOCK_LOW_AND_ABOVE |
נאפשר הצגת תוכן בסטטוס 'שלילי'. |
BLOCK_MEDIUM_AND_ABOVE |
נאפשר הצגת תוכן עם הערכים NEGLIGIBLE ו-LOW. |
BLOCK_ONLY_HIGH |
מותר להציג תוכן עם הערכים NEGLIGIBLE, LOW, ו-MEDIUM. |
BLOCK_NONE |
יאושר כל התוכן. |