Skip to content

Commit 4b75e5d

Browse files
BenjaminKazemicopybara-github
authored andcommitted
feat: Added phish filtering feature.
PiperOrigin-RevId: 826528945
1 parent 97a2fac commit 4b75e5d

File tree

9 files changed

+105
-0
lines changed

9 files changed

+105
-0
lines changed

api-report/genai-node.api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ export enum EndSensitivity {
888888

889889
// @public
890890
export interface EnterpriseWebSearch {
891+
blockingConfidence?: PhishBlockThreshold;
891892
excludeDomains?: string[];
892893
}
893894

@@ -1492,6 +1493,7 @@ export interface GoogleRpcStatus {
14921493

14931494
// @public
14941495
export interface GoogleSearch {
1496+
blockingConfidence?: PhishBlockThreshold;
14951497
excludeDomains?: string[];
14961498
timeRangeFilter?: Interval;
14971499
}
@@ -2413,6 +2415,17 @@ export enum PersonGeneration {
24132415
DONT_ALLOW = "DONT_ALLOW"
24142416
}
24152417

2418+
// @public
2419+
export enum PhishBlockThreshold {
2420+
BLOCK_HIGH_AND_ABOVE = "BLOCK_HIGH_AND_ABOVE",
2421+
BLOCK_HIGHER_AND_ABOVE = "BLOCK_HIGHER_AND_ABOVE",
2422+
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
2423+
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
2424+
BLOCK_ONLY_EXTREMELY_HIGH = "BLOCK_ONLY_EXTREMELY_HIGH",
2425+
BLOCK_VERY_HIGH_AND_ABOVE = "BLOCK_VERY_HIGH_AND_ABOVE",
2426+
PHISH_BLOCK_THRESHOLD_UNSPECIFIED = "PHISH_BLOCK_THRESHOLD_UNSPECIFIED"
2427+
}
2428+
24162429
// @public
24172430
export interface PrebuiltVoiceConfig {
24182431
voiceName?: string;

api-report/genai-web.api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ export enum EndSensitivity {
888888

889889
// @public
890890
export interface EnterpriseWebSearch {
891+
blockingConfidence?: PhishBlockThreshold;
891892
excludeDomains?: string[];
892893
}
893894

@@ -1492,6 +1493,7 @@ export interface GoogleRpcStatus {
14921493

14931494
// @public
14941495
export interface GoogleSearch {
1496+
blockingConfidence?: PhishBlockThreshold;
14951497
excludeDomains?: string[];
14961498
timeRangeFilter?: Interval;
14971499
}
@@ -2413,6 +2415,17 @@ export enum PersonGeneration {
24132415
DONT_ALLOW = "DONT_ALLOW"
24142416
}
24152417

2418+
// @public
2419+
export enum PhishBlockThreshold {
2420+
BLOCK_HIGH_AND_ABOVE = "BLOCK_HIGH_AND_ABOVE",
2421+
BLOCK_HIGHER_AND_ABOVE = "BLOCK_HIGHER_AND_ABOVE",
2422+
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
2423+
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
2424+
BLOCK_ONLY_EXTREMELY_HIGH = "BLOCK_ONLY_EXTREMELY_HIGH",
2425+
BLOCK_VERY_HIGH_AND_ABOVE = "BLOCK_VERY_HIGH_AND_ABOVE",
2426+
PHISH_BLOCK_THRESHOLD_UNSPECIFIED = "PHISH_BLOCK_THRESHOLD_UNSPECIFIED"
2427+
}
2428+
24162429
// @public
24172430
export interface PrebuiltVoiceConfig {
24182431
voiceName?: string;

api-report/genai.api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ export enum EndSensitivity {
888888

889889
// @public
890890
export interface EnterpriseWebSearch {
891+
blockingConfidence?: PhishBlockThreshold;
891892
excludeDomains?: string[];
892893
}
893894

@@ -1492,6 +1493,7 @@ export interface GoogleRpcStatus {
14921493

14931494
// @public
14941495
export interface GoogleSearch {
1496+
blockingConfidence?: PhishBlockThreshold;
14951497
excludeDomains?: string[];
14961498
timeRangeFilter?: Interval;
14971499
}
@@ -2413,6 +2415,17 @@ export enum PersonGeneration {
24132415
DONT_ALLOW = "DONT_ALLOW"
24142416
}
24152417

2418+
// @public
2419+
export enum PhishBlockThreshold {
2420+
BLOCK_HIGH_AND_ABOVE = "BLOCK_HIGH_AND_ABOVE",
2421+
BLOCK_HIGHER_AND_ABOVE = "BLOCK_HIGHER_AND_ABOVE",
2422+
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
2423+
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
2424+
BLOCK_ONLY_EXTREMELY_HIGH = "BLOCK_ONLY_EXTREMELY_HIGH",
2425+
BLOCK_VERY_HIGH_AND_ABOVE = "BLOCK_VERY_HIGH_AND_ABOVE",
2426+
PHISH_BLOCK_THRESHOLD_UNSPECIFIED = "PHISH_BLOCK_THRESHOLD_UNSPECIFIED"
2427+
}
2428+
24162429
// @public
24172430
export interface PrebuiltVoiceConfig {
24182431
voiceName?: string;

src/converters/_batches_converters.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,12 @@ export function googleSearchToMldev(
12531253
throw new Error('excludeDomains parameter is not supported in Gemini API.');
12541254
}
12551255

1256+
if (common.getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
1257+
throw new Error(
1258+
'blockingConfidence parameter is not supported in Gemini API.',
1259+
);
1260+
}
1261+
12561262
const fromTimeRangeFilter = common.getValueByPath(fromObject, [
12571263
'timeRangeFilter',
12581264
]);

src/converters/_caches_converters.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ export function googleSearchToMldev(
442442
throw new Error('excludeDomains parameter is not supported in Gemini API.');
443443
}
444444

445+
if (common.getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
446+
throw new Error(
447+
'blockingConfidence parameter is not supported in Gemini API.',
448+
);
449+
}
450+
445451
const fromTimeRangeFilter = common.getValueByPath(fromObject, [
446452
'timeRangeFilter',
447453
]);

src/converters/_live_converters.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ export function googleSearchToMldev(
332332
throw new Error('excludeDomains parameter is not supported in Gemini API.');
333333
}
334334

335+
if (common.getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
336+
throw new Error(
337+
'blockingConfidence parameter is not supported in Gemini API.',
338+
);
339+
}
340+
335341
const fromTimeRangeFilter = common.getValueByPath(fromObject, [
336342
'timeRangeFilter',
337343
]);

src/converters/_models_converters.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,6 +3177,12 @@ export function googleSearchToMldev(
31773177
throw new Error('excludeDomains parameter is not supported in Gemini API.');
31783178
}
31793179

3180+
if (common.getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
3181+
throw new Error(
3182+
'blockingConfidence parameter is not supported in Gemini API.',
3183+
);
3184+
}
3185+
31803186
const fromTimeRangeFilter = common.getValueByPath(fromObject, [
31813187
'timeRangeFilter',
31823188
]);

src/converters/_tokens_converters.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ export function googleSearchToMldev(
186186
throw new Error('excludeDomains parameter is not supported in Gemini API.');
187187
}
188188

189+
if (common.getValueByPath(fromObject, ['blockingConfidence']) !== undefined) {
190+
throw new Error(
191+
'blockingConfidence parameter is not supported in Gemini API.',
192+
);
193+
}
194+
189195
const fromTimeRangeFilter = common.getValueByPath(fromObject, [
190196
'timeRangeFilter',
191197
]);

src/types.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,38 @@ export enum ApiSpec {
157157
ELASTIC_SEARCH = 'ELASTIC_SEARCH',
158158
}
159159

160+
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
161+
export enum PhishBlockThreshold {
162+
/**
163+
* Defaults to unspecified.
164+
*/
165+
PHISH_BLOCK_THRESHOLD_UNSPECIFIED = 'PHISH_BLOCK_THRESHOLD_UNSPECIFIED',
166+
/**
167+
* Blocks Low and above confidence URL that is risky.
168+
*/
169+
BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE',
170+
/**
171+
* Blocks Medium and above confidence URL that is risky.
172+
*/
173+
BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE',
174+
/**
175+
* Blocks High and above confidence URL that is risky.
176+
*/
177+
BLOCK_HIGH_AND_ABOVE = 'BLOCK_HIGH_AND_ABOVE',
178+
/**
179+
* Blocks Higher and above confidence URL that is risky.
180+
*/
181+
BLOCK_HIGHER_AND_ABOVE = 'BLOCK_HIGHER_AND_ABOVE',
182+
/**
183+
* Blocks Very high and above confidence URL that is risky.
184+
*/
185+
BLOCK_VERY_HIGH_AND_ABOVE = 'BLOCK_VERY_HIGH_AND_ABOVE',
186+
/**
187+
* Blocks Extremely high confidence URL that is risky.
188+
*/
189+
BLOCK_ONLY_EXTREMELY_HIGH = 'BLOCK_ONLY_EXTREMELY_HIGH',
190+
}
191+
160192
/** Harm category. */
161193
export enum HarmCategory {
162194
/**
@@ -1739,6 +1771,8 @@ export declare interface ToolCodeExecution {}
17391771
export declare interface EnterpriseWebSearch {
17401772
/** Optional. List of domains to be excluded from the search results. The default limit is 2000 domains. */
17411773
excludeDomains?: string[];
1774+
/** Optional. Sites with confidence level chosen & above this value will be blocked from the search results. */
1775+
blockingConfidence?: PhishBlockThreshold;
17421776
}
17431777

17441778
/** Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time. */
@@ -1753,6 +1787,8 @@ export declare interface Interval {
17531787
export declare interface GoogleSearch {
17541788
/** Optional. List of domains to be excluded from the search results. The default limit is 2000 domains. Example: ["amazon.com", "facebook.com"]. This field is not supported in Gemini API. */
17551789
excludeDomains?: string[];
1790+
/** Optional. Sites with confidence level chosen & above this value will be blocked from the search results. This field is not supported in Gemini API. */
1791+
blockingConfidence?: PhishBlockThreshold;
17561792
/** Optional. Filter search results to a specific time range. If customers set a start time, they must set an end time (and vice versa). This field is not supported in Vertex AI. */
17571793
timeRangeFilter?: Interval;
17581794
}

0 commit comments

Comments
 (0)