@@ -43,23 +43,42 @@ export enum HarmCategory {
43
43
* @public
44
44
*/
45
45
export enum HarmBlockThreshold {
46
- // Content with NEGLIGIBLE will be allowed.
46
+ /**
47
+ * Content with `NEGLIGIBLE` will be allowed.
48
+ */
47
49
BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE' ,
48
- // Content with NEGLIGIBLE and LOW will be allowed.
50
+ /**
51
+ * Content with `NEGLIGIBLE` and `LOW` will be allowed.
52
+ */
49
53
BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE' ,
50
- // Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed.
54
+ /**
55
+ * Content with `NEGLIGIBLE`, `LOW`, and `MEDIUM` will be allowed.
56
+ */
51
57
BLOCK_ONLY_HIGH = 'BLOCK_ONLY_HIGH' ,
52
- // All content will be allowed.
58
+ /**
59
+ * All content will be allowed.
60
+ */
53
61
BLOCK_NONE = 'BLOCK_NONE' ,
62
+ /**
63
+ * All content will be allowed. This is the same as `BLOCK_NONE`, but the metadata corresponding
64
+ * to the {@link HarmCategory} will not be present in the response.
65
+ */
66
+ OFF = 'OFF' ,
54
67
}
55
68
56
69
/**
70
+ * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
71
+ *
57
72
* @public
58
73
*/
59
74
export enum HarmBlockMethod {
60
- // The harm block method uses both probability and severity scores.
75
+ /**
76
+ * The harm block method uses both probability and severity scores.
77
+ */
61
78
SEVERITY = 'SEVERITY' ,
62
- // The harm block method uses the probability score.
79
+ /**
80
+ * The harm block method uses the probability score.
81
+ */
63
82
PROBABILITY = 'PROBABILITY' ,
64
83
}
65
84
@@ -68,13 +87,21 @@ export enum HarmBlockMethod {
68
87
* @public
69
88
*/
70
89
export enum HarmProbability {
71
- // Content has a negligible chance of being unsafe.
90
+ /**
91
+ * Content has a negligible chance of being unsafe.
92
+ */
72
93
NEGLIGIBLE = 'NEGLIGIBLE' ,
73
- // Content has a low chance of being unsafe.
94
+ /**
95
+ * Content has a low chance of being unsafe.
96
+ */
74
97
LOW = 'LOW' ,
75
- // Content has a medium chance of being unsafe.
98
+ /**
99
+ * Content has a medium chance of being unsafe.
100
+ */
76
101
MEDIUM = 'MEDIUM' ,
77
- // Content has a high chance of being unsafe.
102
+ /**
103
+ * Content has a high chance of being unsafe.
104
+ */
78
105
HIGH = 'HIGH' ,
79
106
}
80
107
@@ -83,13 +110,21 @@ export enum HarmProbability {
83
110
* @public
84
111
*/
85
112
export enum HarmSeverity {
86
- // Negligible level of harm severity.
113
+ /**
114
+ * Negligible level of harm severity.
115
+ */
87
116
HARM_SEVERITY_NEGLIGIBLE = 'HARM_SEVERITY_NEGLIGIBLE' ,
88
- // Low level of harm severity.
117
+ /**
118
+ * Low level of harm severity.
119
+ */
89
120
HARM_SEVERITY_LOW = 'HARM_SEVERITY_LOW' ,
90
- // Medium level of harm severity.
121
+ /**
122
+ * Medium level of harm severity.
123
+ */
91
124
HARM_SEVERITY_MEDIUM = 'HARM_SEVERITY_MEDIUM' ,
92
- // High level of harm severity.
125
+ /**
126
+ * High level of harm severity.
127
+ */
93
128
HARM_SEVERITY_HIGH = 'HARM_SEVERITY_HIGH' ,
94
129
/**
95
130
* Harm severity is not supported.
@@ -105,52 +140,142 @@ export enum HarmSeverity {
105
140
* @public
106
141
*/
107
142
export enum BlockReason {
108
- // The prompt was blocked because it contained terms from the terminology blocklist.
109
- BLOCKLIST = 'BLOCKLIST' ,
110
- // The prompt was blocked due to prohibited content.
111
- PROHIBITED_CONTENT = 'PROHIBITED_CONTENT' ,
112
- // Content was blocked by safety settings.
143
+ /**
144
+ * Content was blocked by safety settings.
145
+ */
113
146
SAFETY = 'SAFETY' ,
114
- // Content was blocked, but the reason is uncategorized.
147
+ /**
148
+ * Content was blocked, but the reason is uncategorized.
149
+ */
115
150
OTHER = 'OTHER' ,
151
+ /**
152
+ * Content was blocked because it contained terms from the terminology blocklist.
153
+ */
154
+ BLOCKLIST = 'BLOCKLIST' ,
155
+ /**
156
+ * Content was blocked due to prohibited content.
157
+ */
158
+ PROHIBITED_CONTENT = 'PROHIBITED_CONTENT' ,
116
159
}
117
160
118
161
/**
119
162
* Reason that a candidate finished.
120
163
* @public
121
164
*/
122
165
export enum FinishReason {
123
- // Token generation was stopped because the response contained forbidden terms.
124
- BLOCKLIST = 'BLOCKLIST' ,
125
- // Token generation was stopped because the response contained potentially prohibited content.
126
- PROHIBITED_CONTENT = 'PROHIBITED_CONTENT' ,
127
- // Token generation was stopped because of Sensitive Personally Identifiable Information (SPII).
128
- SPII = 'SPII' ,
129
- // Natural stop point of the model or provided stop sequence.
166
+ /**
167
+ * Natural stop point of the model or provided stop sequence.
168
+ */
130
169
STOP = 'STOP' ,
131
- // The maximum number of tokens as specified in the request was reached.
170
+ /**
171
+ * The maximum number of tokens as specified in the request was reached.
172
+ */
132
173
MAX_TOKENS = 'MAX_TOKENS' ,
133
- // The candidate content was flagged for safety reasons.
174
+ /**
175
+ * The candidate content was flagged for safety reasons.
176
+ */
134
177
SAFETY = 'SAFETY' ,
135
- // The candidate content was flagged for recitation reasons.
178
+ /**
179
+ * The candidate content was flagged for recitation reasons.
180
+ */
136
181
RECITATION = 'RECITATION' ,
137
- // Unknown reason.
182
+ /**
183
+ * Unknown reason.
184
+ */
138
185
OTHER = 'OTHER' ,
186
+ /**
187
+ * The candidate content contained forbidden terms.
188
+ */
189
+ BLOCKLIST = 'BLOCKLIST' ,
190
+ /**
191
+ * The candidate content potentially contained prohibited content.
192
+ */
193
+ PROHIBITED_CONTENT = 'PROHIBITED_CONTENT' ,
194
+ /**
195
+ * The candidate content potentially contained Sensitive Personally Identifiable Information (SPII).
196
+ */
197
+ SPII = 'SPII' ,
198
+ /**
199
+ * The function call generated by the model was invalid.
200
+ */
201
+ MALFORMED_FUNCTION_CALL = 'MALFORMED_FUNCTION_CALL' ,
139
202
}
140
203
141
204
/**
142
205
* @public
143
206
*/
144
207
export enum FunctionCallingMode {
145
- // Default model behavior, model decides to predict either a function call
146
- // or a natural language response.
208
+ /**
209
+ * Default model behavior; model decides to predict either a function call
210
+ * or a natural language response.
211
+ */
147
212
AUTO = 'AUTO' ,
148
- // Model is constrained to always predicting a function call only.
149
- // If "allowed_function_names" is set, the predicted function call will be
150
- // limited to any one of "allowed_function_names", else the predicted
151
- // function call will be any one of the provided "function_declarations".
213
+ /**
214
+ * Model is constrained to always predicting a function call only.
215
+ * If `allowed_function_names` is set, the predicted function call will be
216
+ * limited to any one of `allowed_function_names`, else the predicted
217
+ * function call will be any one of the provided `function_declarations`.
218
+ */
152
219
ANY = 'ANY' ,
153
- // Model will not predict any function call. Model behavior is same as when
154
- // not passing any function declarations.
220
+ /**
221
+ * Model will not predict any function call. Model behavior is same as when
222
+ * not passing any function declarations.
223
+ */
155
224
NONE = 'NONE' ,
156
225
}
226
+
227
+ /**
228
+ * Content part modality.
229
+ * @public
230
+ */
231
+ export enum Modality {
232
+ /**
233
+ * Unspecified modality.
234
+ */
235
+ MODALITY_UNSPECIFIED = 'MODALITY_UNSPECIFIED' ,
236
+ /**
237
+ * Plain text.
238
+ */
239
+ TEXT = 'TEXT' ,
240
+ /**
241
+ * Image.
242
+ */
243
+ IMAGE = 'IMAGE' ,
244
+ /**
245
+ * Video.
246
+ */
247
+ VIDEO = 'VIDEO' ,
248
+ /**
249
+ * Audio.
250
+ */
251
+ AUDIO = 'AUDIO' ,
252
+ /**
253
+ * Document (for example, PDF).
254
+ */
255
+ DOCUMENT = 'DOCUMENT' ,
256
+ }
257
+
258
+ /**
259
+ * Generation modalities to be returned in generation responses.
260
+ *
261
+ * @beta
262
+ */
263
+ export const ResponseModality = {
264
+ /**
265
+ * Text.
266
+ * @beta
267
+ */
268
+ TEXT : 'TEXT' ,
269
+ /**
270
+ * Image.
271
+ * @beta
272
+ */
273
+ IMAGE : 'IMAGE' ,
274
+ } as const ;
275
+
276
+ /**
277
+ * Generation modalities to be returned in generation responses.
278
+ *
279
+ * @beta
280
+ */
281
+ export type ResponseModality = ( typeof ResponseModality ) [ keyof typeof ResponseModality ] ;
0 commit comments