Skip to content

Commit 21e06f4

Browse files
google-genai-botcopybara-github
authored andcommitted
feat(interaction-api): Add safety_settings and labels to interaction.proto
PiperOrigin-RevId: 926775718
1 parent b72db47 commit 21e06f4

1 file changed

Lines changed: 152 additions & 0 deletions

File tree

src/interactions/resources/interactions.ts

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,17 @@ export interface Interaction {
12831283
| DocumentContent
12841284
| VideoContent;
12851285

1286+
/**
1287+
* Optional. The labels with user-defined metadata for the request. It is used for
1288+
* billing and reporting only.
1289+
*
1290+
* Label keys and values can be no longer than 63 characters (Unicode codepoints)
1291+
* and can only contain lowercase letters, numeric characters, underscores, and
1292+
* dashes. International characters are allowed. Label values are optional. Label
1293+
* keys must start with a letter.
1294+
*/
1295+
labels?: { [key: string]: string };
1296+
12861297
/**
12871298
* The name of the `Model` used for generating the interaction.
12881299
*/
@@ -1320,6 +1331,11 @@ export interface Interaction {
13201331
*/
13211332
role?: string;
13221333

1334+
/**
1335+
* Safety settings for the interaction.
1336+
*/
1337+
safety_settings?: Array<Interaction.SafetySetting>;
1338+
13231339
/**
13241340
* The service tier for the interaction.
13251341
*/
@@ -1528,6 +1544,40 @@ export namespace Interaction {
15281544
path?: string;
15291545
}
15301546
}
1547+
1548+
/**
1549+
* A safety setting that affects the safety-blocking behavior.
1550+
*
1551+
* A SafetySetting consists of a harm category and a threshold for that category.
1552+
*/
1553+
export interface SafetySetting {
1554+
/**
1555+
* Required. The harm category to be blocked.
1556+
*/
1557+
category:
1558+
| 'hate_speech'
1559+
| 'dangerous_content'
1560+
| 'harassment'
1561+
| 'sexually_explicit'
1562+
| 'civic_integrity'
1563+
| 'image_hate'
1564+
| 'image_dangerous_content'
1565+
| 'image_harassment'
1566+
| 'image_sexually_explicit'
1567+
| 'jailbreak';
1568+
1569+
/**
1570+
* Required. The threshold for blocking content. If the harm probability exceeds
1571+
* this threshold, the content will be blocked.
1572+
*/
1573+
threshold: 'block_low_and_above' | 'block_medium_and_above' | 'block_only_high' | 'block_none' | 'off';
1574+
1575+
/**
1576+
* Optional. The method for blocking content. If not specified, the default
1577+
* behavior is to use the probability score.
1578+
*/
1579+
method?: 'severity' | 'probability';
1580+
}
15311581
}
15321582

15331583
export interface InteractionCompletedEvent {
@@ -3033,6 +3083,17 @@ export interface BaseCreateModelInteractionParams {
30333083
*/
30343084
generation_config?: GenerationConfig;
30353085

3086+
/**
3087+
* Body param: Optional. The labels with user-defined metadata for the request. It
3088+
* is used for billing and reporting only.
3089+
*
3090+
* Label keys and values can be no longer than 63 characters (Unicode codepoints)
3091+
* and can only contain lowercase letters, numeric characters, underscores, and
3092+
* dashes. International characters are allowed. Label values are optional. Label
3093+
* keys must start with a letter.
3094+
*/
3095+
labels?: { [key: string]: string };
3096+
30363097
/**
30373098
* Body param: The ID of the previous interaction, if any.
30383099
*/
@@ -3060,6 +3121,11 @@ export interface BaseCreateModelInteractionParams {
30603121
*/
30613122
response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
30623123

3124+
/**
3125+
* Body param: Safety settings for the interaction.
3126+
*/
3127+
safety_settings?: Array<BaseCreateModelInteractionParams.SafetySetting>;
3128+
30633129
/**
30643130
* Body param: The service tier for the interaction.
30653131
*/
@@ -3093,6 +3159,42 @@ export interface BaseCreateModelInteractionParams {
30933159
webhook_config?: WebhookConfig;
30943160
}
30953161

3162+
export namespace BaseCreateModelInteractionParams {
3163+
/**
3164+
* A safety setting that affects the safety-blocking behavior.
3165+
*
3166+
* A SafetySetting consists of a harm category and a threshold for that category.
3167+
*/
3168+
export interface SafetySetting {
3169+
/**
3170+
* Required. The harm category to be blocked.
3171+
*/
3172+
category:
3173+
| 'hate_speech'
3174+
| 'dangerous_content'
3175+
| 'harassment'
3176+
| 'sexually_explicit'
3177+
| 'civic_integrity'
3178+
| 'image_hate'
3179+
| 'image_dangerous_content'
3180+
| 'image_harassment'
3181+
| 'image_sexually_explicit'
3182+
| 'jailbreak';
3183+
3184+
/**
3185+
* Required. The threshold for blocking content. If the harm probability exceeds
3186+
* this threshold, the content will be blocked.
3187+
*/
3188+
threshold: 'block_low_and_above' | 'block_medium_and_above' | 'block_only_high' | 'block_none' | 'off';
3189+
3190+
/**
3191+
* Optional. The method for blocking content. If not specified, the default
3192+
* behavior is to use the probability score.
3193+
*/
3194+
method?: 'severity' | 'probability';
3195+
}
3196+
}
3197+
30963198
export interface BaseCreateAgentInteractionParams {
30973199
/**
30983200
* Path param: Which version of the API to use.
@@ -3143,6 +3245,17 @@ export interface BaseCreateAgentInteractionParams {
31433245
*/
31443246
environment?: Environment | string;
31453247

3248+
/**
3249+
* Body param: Optional. The labels with user-defined metadata for the request. It
3250+
* is used for billing and reporting only.
3251+
*
3252+
* Label keys and values can be no longer than 63 characters (Unicode codepoints)
3253+
* and can only contain lowercase letters, numeric characters, underscores, and
3254+
* dashes. International characters are allowed. Label values are optional. Label
3255+
* keys must start with a letter.
3256+
*/
3257+
labels?: { [key: string]: string };
3258+
31463259
/**
31473260
* Body param: The ID of the previous interaction, if any.
31483261
*/
@@ -3170,6 +3283,11 @@ export interface BaseCreateAgentInteractionParams {
31703283
*/
31713284
response_modalities?: Array<'text' | 'image' | 'audio' | 'video' | 'document'>;
31723285

3286+
/**
3287+
* Body param: Safety settings for the interaction.
3288+
*/
3289+
safety_settings?: Array<BaseCreateAgentInteractionParams.SafetySetting>;
3290+
31733291
/**
31743292
* Body param: The service tier for the interaction.
31753293
*/
@@ -3356,6 +3474,40 @@ export namespace BaseCreateAgentInteractionParams {
33563474
path?: string;
33573475
}
33583476
}
3477+
3478+
/**
3479+
* A safety setting that affects the safety-blocking behavior.
3480+
*
3481+
* A SafetySetting consists of a harm category and a threshold for that category.
3482+
*/
3483+
export interface SafetySetting {
3484+
/**
3485+
* Required. The harm category to be blocked.
3486+
*/
3487+
category:
3488+
| 'hate_speech'
3489+
| 'dangerous_content'
3490+
| 'harassment'
3491+
| 'sexually_explicit'
3492+
| 'civic_integrity'
3493+
| 'image_hate'
3494+
| 'image_dangerous_content'
3495+
| 'image_harassment'
3496+
| 'image_sexually_explicit'
3497+
| 'jailbreak';
3498+
3499+
/**
3500+
* Required. The threshold for blocking content. If the harm probability exceeds
3501+
* this threshold, the content will be blocked.
3502+
*/
3503+
threshold: 'block_low_and_above' | 'block_medium_and_above' | 'block_only_high' | 'block_none' | 'off';
3504+
3505+
/**
3506+
* Optional. The method for blocking content. If not specified, the default
3507+
* behavior is to use the probability score.
3508+
*/
3509+
method?: 'severity' | 'probability';
3510+
}
33593511
}
33603512

33613513
export interface CreateModelInteractionParamsNonStreaming extends BaseCreateModelInteractionParams {

0 commit comments

Comments
 (0)