@orq-ai/node 4.14.11 → 4.14.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/evaluatorresponsefunction.js +2 -2
- package/models/components/evaluatorresponsehttp.js +2 -2
- package/models/components/evaluatorresponsejsonschema.js +2 -2
- package/models/components/evaluatorresponsellm.js +2 -2
- package/models/components/evaluatorresponsepython.js +2 -2
- package/models/components/evaluatorresponseragas.js +2 -2
- package/models/components/evaluatorresponsetypescript.js +2 -2
- package/models/components/reasoningpart.js +1 -1
- package/models/operations/createannotationqueue.js +1 -1
- package/models/operations/createdataset.js +1 -1
- package/models/operations/createdatasetitem.js +5 -5
- package/models/operations/createtool.js +4 -4
- package/models/operations/getalltools.js +4 -4
- package/models/operations/geteval.js +16 -16
- package/models/operations/getv2humanevalsets.js +2 -2
- package/models/operations/getv2humanevalsetsid.js +2 -2
- package/models/operations/listannotationqueues.js +1 -1
- package/models/operations/listdatasetdatapoints.js +5 -5
- package/models/operations/listdatasets.js +1 -1
- package/models/operations/patchv2humanevalsetsid.js +2 -2
- package/models/operations/postv2feedbackevaluation.js +4 -4
- package/models/operations/postv2humanevalsets.js +2 -2
- package/models/operations/retrieveannotationqueue.js +1 -1
- package/models/operations/retrievedatapoint.js +5 -5
- package/models/operations/retrievedataset.js +1 -1
- package/models/operations/retrievetool.js +4 -4
- package/models/operations/runagent.js +1 -1
- package/models/operations/streamrunagent.js +1 -1
- package/models/operations/updateannotationqueue.js +1 -1
- package/models/operations/updatedatapoint.js +5 -5
- package/models/operations/updatedataset.js +1 -1
- package/models/operations/updatetool.js +4 -4
- package/package.json +3 -3
- package/packages/orq-rc/src/funcs/piiCapabilities.ts +144 -0
- package/packages/orq-rc/src/lib/config.ts +2 -2
- package/packages/orq-rc/src/models/components/agentstartedstreamingevent.ts +11 -1
- package/packages/orq-rc/src/models/components/capabilitiesresponse.ts +96 -0
- package/packages/orq-rc/src/models/components/createmcpgatewayrequest.ts +11 -0
- package/packages/orq-rc/src/models/components/detectrequest.ts +48 -0
- package/packages/orq-rc/src/models/components/entitylist.ts +37 -0
- package/packages/orq-rc/src/models/components/guardrailruleplugin.ts +27 -0
- package/packages/orq-rc/src/models/components/index.ts +4 -3
- package/packages/orq-rc/src/models/components/mcpgateway.ts +9 -0
- package/packages/orq-rc/src/models/components/mcpgatewayplugin.ts +83 -0
- package/packages/orq-rc/src/models/components/monitorfilter.ts +8 -0
- package/packages/orq-rc/src/models/components/piiredactionplugin.ts +143 -0
- package/packages/orq-rc/src/models/components/publicplugin.ts +17 -21
- package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
- package/packages/orq-rc/src/models/components/redactrequest.ts +52 -0
- package/packages/orq-rc/src/models/components/responsehealingplugin.ts +4 -27
- package/packages/orq-rc/src/models/components/routingruleplugin.ts +27 -0
- package/packages/orq-rc/src/models/components/tracescrubbingplugin.ts +4 -24
- package/packages/orq-rc/src/models/components/updatemcpgatewayrequest.ts +11 -0
- package/packages/orq-rc/src/models/operations/createagentrequest.ts +85 -87
- package/packages/orq-rc/src/models/operations/createchatcompletion.ts +18 -26
- package/packages/orq-rc/src/models/operations/createcompletion.ts +3 -51
- package/packages/orq-rc/src/models/operations/createdataset.ts +1 -1
- package/packages/orq-rc/src/models/operations/createdatasetitem.ts +5 -5
- package/packages/orq-rc/src/models/operations/createimage.ts +3 -51
- package/packages/orq-rc/src/models/operations/createprompt.ts +31 -43
- package/packages/orq-rc/src/models/operations/creatererank.ts +3 -51
- package/packages/orq-rc/src/models/operations/createtool.ts +4 -4
- package/packages/orq-rc/src/models/operations/getallprompts.ts +13 -17
- package/packages/orq-rc/src/models/operations/getalltools.ts +4 -4
- package/packages/orq-rc/src/models/operations/getoneprompt.ts +13 -17
- package/packages/orq-rc/src/models/operations/getpromptversion.ts +13 -17
- package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
- package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
- package/packages/orq-rc/src/models/operations/listagents.ts +37 -35
- package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +5 -5
- package/packages/orq-rc/src/models/operations/listdatasets.ts +1 -1
- package/packages/orq-rc/src/models/operations/listpromptversions.ts +13 -17
- package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
- package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +4 -4
- package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
- package/packages/orq-rc/src/models/operations/retrieveagentrequest.ts +37 -35
- package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +5 -5
- package/packages/orq-rc/src/models/operations/retrievedataset.ts +1 -1
- package/packages/orq-rc/src/models/operations/retrievetool.ts +4 -4
- package/packages/orq-rc/src/models/operations/runagent.ts +49 -53
- package/packages/orq-rc/src/models/operations/streamrunagent.ts +49 -53
- package/packages/orq-rc/src/models/operations/updateagent.ts +85 -87
- package/packages/orq-rc/src/models/operations/updatedatapoint.ts +5 -5
- package/packages/orq-rc/src/models/operations/updatedataset.ts +1 -1
- package/packages/orq-rc/src/models/operations/updateprompt.ts +31 -43
- package/packages/orq-rc/src/models/operations/updatetool.ts +4 -4
- package/packages/orq-rc/src/sdk/pii.ts +16 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/evaluatorresponsefunction.ts +2 -2
- package/src/models/components/evaluatorresponsehttp.ts +2 -2
- package/src/models/components/evaluatorresponsejsonschema.ts +2 -2
- package/src/models/components/evaluatorresponsellm.ts +2 -2
- package/src/models/components/evaluatorresponsepython.ts +2 -2
- package/src/models/components/evaluatorresponseragas.ts +2 -2
- package/src/models/components/evaluatorresponsetypescript.ts +2 -2
- package/src/models/components/reasoningpart.ts +1 -1
- package/src/models/operations/createannotationqueue.ts +1 -1
- package/src/models/operations/createdataset.ts +1 -1
- package/src/models/operations/createdatasetitem.ts +5 -5
- package/src/models/operations/createtool.ts +4 -4
- package/src/models/operations/getalltools.ts +4 -4
- package/src/models/operations/geteval.ts +16 -16
- package/src/models/operations/getv2humanevalsets.ts +2 -2
- package/src/models/operations/getv2humanevalsetsid.ts +2 -2
- package/src/models/operations/listannotationqueues.ts +1 -1
- package/src/models/operations/listdatasetdatapoints.ts +5 -5
- package/src/models/operations/listdatasets.ts +1 -1
- package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
- package/src/models/operations/postv2feedbackevaluation.ts +4 -4
- package/src/models/operations/postv2humanevalsets.ts +2 -2
- package/src/models/operations/retrieveannotationqueue.ts +1 -1
- package/src/models/operations/retrievedatapoint.ts +5 -5
- package/src/models/operations/retrievedataset.ts +1 -1
- package/src/models/operations/retrievetool.ts +4 -4
- package/src/models/operations/runagent.ts +1 -1
- package/src/models/operations/streamrunagent.ts +1 -1
- package/src/models/operations/updateannotationqueue.ts +1 -1
- package/src/models/operations/updatedatapoint.ts +5 -5
- package/src/models/operations/updatedataset.ts +1 -1
- package/src/models/operations/updatetool.ts +4 -4
- package/packages/orq-rc/src/models/components/piiredactionpluginauto.ts +0 -185
- package/packages/orq-rc/src/models/components/piiredactionpluginen.ts +0 -222
- package/packages/orq-rc/src/models/components/piiredactionpluginnl.ts +0 -218
|
@@ -13,10 +13,29 @@ export type GuardrailRulePlugin = {
|
|
|
13
13
|
* Plugin discriminator.
|
|
14
14
|
*/
|
|
15
15
|
id?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Languages, regions and entity types are checked against the live
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* pii-detection capabilities catalog when the rule is saved, not pinned
|
|
21
|
+
* here, so a language or region the detector gains becomes writable without
|
|
22
|
+
* a proto change.
|
|
23
|
+
*/
|
|
16
24
|
language?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Entity types to redact. Mutually exclusive with regions.
|
|
27
|
+
*/
|
|
17
28
|
entities?: Array<string> | undefined;
|
|
18
29
|
onFailure?: string | undefined;
|
|
19
30
|
threshold?: number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Regions of coverage by ISO 3166-1 alpha-2 code, or ["all"]. Mutually exclusive with entities.
|
|
33
|
+
*/
|
|
34
|
+
regions?: Array<string> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Per-entity-type confidence cutoff. Every key must also appear in entities.
|
|
37
|
+
*/
|
|
38
|
+
entityThresholds?: { [k: string]: number } | undefined;
|
|
20
39
|
};
|
|
21
40
|
|
|
22
41
|
/** @internal */
|
|
@@ -30,9 +49,12 @@ export const GuardrailRulePlugin$inboundSchema: z.ZodType<
|
|
|
30
49
|
entities: z.array(z.string()).optional(),
|
|
31
50
|
on_failure: z.string().optional(),
|
|
32
51
|
threshold: z.number().optional(),
|
|
52
|
+
regions: z.array(z.string()).optional(),
|
|
53
|
+
entity_thresholds: z.record(z.number()).optional(),
|
|
33
54
|
}).transform((v) => {
|
|
34
55
|
return remap$(v, {
|
|
35
56
|
"on_failure": "onFailure",
|
|
57
|
+
"entity_thresholds": "entityThresholds",
|
|
36
58
|
});
|
|
37
59
|
});
|
|
38
60
|
/** @internal */
|
|
@@ -42,6 +64,8 @@ export type GuardrailRulePlugin$Outbound = {
|
|
|
42
64
|
entities?: Array<string> | undefined;
|
|
43
65
|
on_failure?: string | undefined;
|
|
44
66
|
threshold?: number | undefined;
|
|
67
|
+
regions?: Array<string> | undefined;
|
|
68
|
+
entity_thresholds?: { [k: string]: number } | undefined;
|
|
45
69
|
};
|
|
46
70
|
|
|
47
71
|
/** @internal */
|
|
@@ -55,9 +79,12 @@ export const GuardrailRulePlugin$outboundSchema: z.ZodType<
|
|
|
55
79
|
entities: z.array(z.string()).optional(),
|
|
56
80
|
onFailure: z.string().optional(),
|
|
57
81
|
threshold: z.number().optional(),
|
|
82
|
+
regions: z.array(z.string()).optional(),
|
|
83
|
+
entityThresholds: z.record(z.number()).optional(),
|
|
58
84
|
}).transform((v) => {
|
|
59
85
|
return remap$(v, {
|
|
60
86
|
onFailure: "on_failure",
|
|
87
|
+
entityThresholds: "entity_thresholds",
|
|
61
88
|
});
|
|
62
89
|
});
|
|
63
90
|
|
|
@@ -73,6 +73,7 @@ export * from "./budgetsortfield.js";
|
|
|
73
73
|
export * from "./budgetusage.js";
|
|
74
74
|
export * from "./cacheconfig.js";
|
|
75
75
|
export * from "./callsubagenttoolinput.js";
|
|
76
|
+
export * from "./capabilitiesresponse.js";
|
|
76
77
|
export * from "./chunk.js";
|
|
77
78
|
export * from "./chunkingcleanupoptions.js";
|
|
78
79
|
export * from "./chunkingconfiguration.js";
|
|
@@ -177,6 +178,7 @@ export * from "./embeddingretryconfig.js";
|
|
|
177
178
|
export * from "./embeddingsconfig.js";
|
|
178
179
|
export * from "./embeddingsmodelparameters.js";
|
|
179
180
|
export * from "./embeddingtimeoutconfig.js";
|
|
181
|
+
export * from "./entitylist.js";
|
|
180
182
|
export * from "./errorpart.js";
|
|
181
183
|
export * from "./errorstreamingevent.js";
|
|
182
184
|
export * from "./evaluationcontext.js";
|
|
@@ -322,6 +324,7 @@ export * from "./mcpconnection.js";
|
|
|
322
324
|
export * from "./mcpconnectiontype.js";
|
|
323
325
|
export * from "./mcpgateway.js";
|
|
324
326
|
export * from "./mcpgatewaymode.js";
|
|
327
|
+
export * from "./mcpgatewayplugin.js";
|
|
325
328
|
export * from "./mcpgatewayserverlink.js";
|
|
326
329
|
export * from "./mcpgatewaystatus.js";
|
|
327
330
|
export * from "./mcpgatewaytool.js";
|
|
@@ -371,9 +374,7 @@ export * from "./partdoneevent.js";
|
|
|
371
374
|
export * from "./permissionmode.js";
|
|
372
375
|
export * from "./piiredaction.js";
|
|
373
376
|
export * from "./piiredactionconfig.js";
|
|
374
|
-
export * from "./
|
|
375
|
-
export * from "./piiredactionpluginen.js";
|
|
376
|
-
export * from "./piiredactionpluginnl.js";
|
|
377
|
+
export * from "./piiredactionplugin.js";
|
|
377
378
|
export * from "./policy.js";
|
|
378
379
|
export * from "./policyretryconfig.js";
|
|
379
380
|
export * from "./previewchunk.js";
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
McpGatewayMode,
|
|
12
12
|
McpGatewayMode$inboundSchema,
|
|
13
13
|
} from "./mcpgatewaymode.js";
|
|
14
|
+
import {
|
|
15
|
+
McpGatewayPlugin,
|
|
16
|
+
McpGatewayPlugin$inboundSchema,
|
|
17
|
+
} from "./mcpgatewayplugin.js";
|
|
14
18
|
import {
|
|
15
19
|
McpGatewayServerLink,
|
|
16
20
|
McpGatewayServerLink$inboundSchema,
|
|
@@ -66,6 +70,10 @@ export type McpGateway = {
|
|
|
66
70
|
* Which projects in the workspace may use this gateway.
|
|
67
71
|
*/
|
|
68
72
|
sharing?: Sharing | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Plugins run on every tool call this gateway serves.
|
|
75
|
+
*/
|
|
76
|
+
plugins?: Array<McpGatewayPlugin> | undefined;
|
|
69
77
|
};
|
|
70
78
|
|
|
71
79
|
/** @internal */
|
|
@@ -87,6 +95,7 @@ export const McpGateway$inboundSchema: z.ZodType<
|
|
|
87
95
|
exposed_tools_count: z.number().int().optional(),
|
|
88
96
|
mode: McpGatewayMode$inboundSchema.optional(),
|
|
89
97
|
sharing: Sharing$inboundSchema.optional(),
|
|
98
|
+
plugins: z.array(McpGatewayPlugin$inboundSchema).optional(),
|
|
90
99
|
}).transform((v) => {
|
|
91
100
|
return remap$(v, {
|
|
92
101
|
"display_name": "displayName",
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type McpGatewayPlugin = {
|
|
12
|
+
/**
|
|
13
|
+
* Plugin discriminator.
|
|
14
|
+
*/
|
|
15
|
+
id?: string | undefined;
|
|
16
|
+
language?: string | undefined;
|
|
17
|
+
entities?: Array<string> | undefined;
|
|
18
|
+
onFailure?: string | undefined;
|
|
19
|
+
threshold?: number | undefined;
|
|
20
|
+
mask?: Array<string> | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const McpGatewayPlugin$inboundSchema: z.ZodType<
|
|
25
|
+
McpGatewayPlugin,
|
|
26
|
+
z.ZodTypeDef,
|
|
27
|
+
unknown
|
|
28
|
+
> = z.object({
|
|
29
|
+
id: z.string().optional(),
|
|
30
|
+
language: z.string().optional(),
|
|
31
|
+
entities: z.array(z.string()).optional(),
|
|
32
|
+
on_failure: z.string().optional(),
|
|
33
|
+
threshold: z.number().optional(),
|
|
34
|
+
mask: z.array(z.string()).optional(),
|
|
35
|
+
}).transform((v) => {
|
|
36
|
+
return remap$(v, {
|
|
37
|
+
"on_failure": "onFailure",
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type McpGatewayPlugin$Outbound = {
|
|
42
|
+
id?: string | undefined;
|
|
43
|
+
language?: string | undefined;
|
|
44
|
+
entities?: Array<string> | undefined;
|
|
45
|
+
on_failure?: string | undefined;
|
|
46
|
+
threshold?: number | undefined;
|
|
47
|
+
mask?: Array<string> | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const McpGatewayPlugin$outboundSchema: z.ZodType<
|
|
52
|
+
McpGatewayPlugin$Outbound,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
McpGatewayPlugin
|
|
55
|
+
> = z.object({
|
|
56
|
+
id: z.string().optional(),
|
|
57
|
+
language: z.string().optional(),
|
|
58
|
+
entities: z.array(z.string()).optional(),
|
|
59
|
+
onFailure: z.string().optional(),
|
|
60
|
+
threshold: z.number().optional(),
|
|
61
|
+
mask: z.array(z.string()).optional(),
|
|
62
|
+
}).transform((v) => {
|
|
63
|
+
return remap$(v, {
|
|
64
|
+
onFailure: "on_failure",
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export function mcpGatewayPluginToJSON(
|
|
69
|
+
mcpGatewayPlugin: McpGatewayPlugin,
|
|
70
|
+
): string {
|
|
71
|
+
return JSON.stringify(
|
|
72
|
+
McpGatewayPlugin$outboundSchema.parse(mcpGatewayPlugin),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
export function mcpGatewayPluginFromJSON(
|
|
76
|
+
jsonString: string,
|
|
77
|
+
): SafeParseResult<McpGatewayPlugin, SDKValidationError> {
|
|
78
|
+
return safeParse(
|
|
79
|
+
jsonString,
|
|
80
|
+
(x) => McpGatewayPlugin$inboundSchema.parse(JSON.parse(x)),
|
|
81
|
+
`Failed to parse 'McpGatewayPlugin' from JSON`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -16,6 +16,14 @@ export const Op = {
|
|
|
16
16
|
Neq: "neq",
|
|
17
17
|
In: "in",
|
|
18
18
|
NotIn: "not_in",
|
|
19
|
+
Gt: "gt",
|
|
20
|
+
Gte: "gte",
|
|
21
|
+
Lt: "lt",
|
|
22
|
+
Lte: "lte",
|
|
23
|
+
Between: "between",
|
|
24
|
+
Contains: "contains",
|
|
25
|
+
Exists: "exists",
|
|
26
|
+
NotExists: "not_exists",
|
|
19
27
|
} as const;
|
|
20
28
|
/**
|
|
21
29
|
* Predicate operator. `eq` and `neq` accept exactly one value; `in` and `not_in` accept 1-100 values.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* PII redaction plugin.
|
|
14
|
+
*/
|
|
15
|
+
export const Id = {
|
|
16
|
+
PiiRedaction: "pii_redaction",
|
|
17
|
+
} as const;
|
|
18
|
+
/**
|
|
19
|
+
* PII redaction plugin.
|
|
20
|
+
*/
|
|
21
|
+
export type Id = ClosedEnum<typeof Id>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Behaviour when detection fails.
|
|
25
|
+
*/
|
|
26
|
+
export const OnFailure = {
|
|
27
|
+
Block: "block",
|
|
28
|
+
Passthrough: "passthrough",
|
|
29
|
+
} as const;
|
|
30
|
+
/**
|
|
31
|
+
* Behaviour when detection fails.
|
|
32
|
+
*/
|
|
33
|
+
export type OnFailure = ClosedEnum<typeof OnFailure>;
|
|
34
|
+
|
|
35
|
+
export type PIIRedactionPlugin = {
|
|
36
|
+
/**
|
|
37
|
+
* PII redaction plugin.
|
|
38
|
+
*/
|
|
39
|
+
id: Id;
|
|
40
|
+
/**
|
|
41
|
+
* Detector language. Use "auto" to auto-detect; omitting the field falls back to en.
|
|
42
|
+
*/
|
|
43
|
+
language?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Region codes selecting whole regions of coverage (e.g. "nl", "gb"). Every entity type those regions cover is redacted, alongside the base catalog. ["all"] is exclusive, and leaving both this and entities empty also runs every region, so selecting nothing is the widest request rather than the narrowest. Combines with entities: the two selections are unioned, so entities adds types on top of the region coverage.
|
|
46
|
+
*/
|
|
47
|
+
regions?: Array<string> | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* The entity types to redact. A named type is redacted even when it belongs to a region, so a region's types can be selected individually without naming the region. On its own this is a strict allowlist; alongside regions it adds to the region coverage. See GET /v2/pii/capabilities for valid types.
|
|
50
|
+
*/
|
|
51
|
+
entities?: Array<string> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Per-entity confidence cutoff overrides in [0,1]. Tunes confidence only and never changes which types are redacted, so every key must also appear in entities.
|
|
54
|
+
*/
|
|
55
|
+
entityThresholds?: { [k: string]: number } | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Baseline confidence cutoff applied to every entity type without a per-entity override.
|
|
58
|
+
*/
|
|
59
|
+
threshold?: number | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Behaviour when detection fails.
|
|
62
|
+
*/
|
|
63
|
+
onFailure?: OnFailure | undefined;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** @internal */
|
|
67
|
+
export const Id$inboundSchema: z.ZodNativeEnum<typeof Id> = z.nativeEnum(Id);
|
|
68
|
+
/** @internal */
|
|
69
|
+
export const Id$outboundSchema: z.ZodNativeEnum<typeof Id> = Id$inboundSchema;
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const OnFailure$inboundSchema: z.ZodNativeEnum<typeof OnFailure> = z
|
|
73
|
+
.nativeEnum(OnFailure);
|
|
74
|
+
/** @internal */
|
|
75
|
+
export const OnFailure$outboundSchema: z.ZodNativeEnum<typeof OnFailure> =
|
|
76
|
+
OnFailure$inboundSchema;
|
|
77
|
+
|
|
78
|
+
/** @internal */
|
|
79
|
+
export const PIIRedactionPlugin$inboundSchema: z.ZodType<
|
|
80
|
+
PIIRedactionPlugin,
|
|
81
|
+
z.ZodTypeDef,
|
|
82
|
+
unknown
|
|
83
|
+
> = z.object({
|
|
84
|
+
id: Id$inboundSchema,
|
|
85
|
+
language: z.string().optional(),
|
|
86
|
+
regions: z.array(z.string()).optional(),
|
|
87
|
+
entities: z.array(z.string()).optional(),
|
|
88
|
+
entity_thresholds: z.record(z.number()).optional(),
|
|
89
|
+
threshold: z.number().optional(),
|
|
90
|
+
on_failure: OnFailure$inboundSchema.optional(),
|
|
91
|
+
}).transform((v) => {
|
|
92
|
+
return remap$(v, {
|
|
93
|
+
"entity_thresholds": "entityThresholds",
|
|
94
|
+
"on_failure": "onFailure",
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
/** @internal */
|
|
98
|
+
export type PIIRedactionPlugin$Outbound = {
|
|
99
|
+
id: string;
|
|
100
|
+
language?: string | undefined;
|
|
101
|
+
regions?: Array<string> | undefined;
|
|
102
|
+
entities?: Array<string> | undefined;
|
|
103
|
+
entity_thresholds?: { [k: string]: number } | undefined;
|
|
104
|
+
threshold?: number | undefined;
|
|
105
|
+
on_failure?: string | undefined;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** @internal */
|
|
109
|
+
export const PIIRedactionPlugin$outboundSchema: z.ZodType<
|
|
110
|
+
PIIRedactionPlugin$Outbound,
|
|
111
|
+
z.ZodTypeDef,
|
|
112
|
+
PIIRedactionPlugin
|
|
113
|
+
> = z.object({
|
|
114
|
+
id: Id$outboundSchema,
|
|
115
|
+
language: z.string().optional(),
|
|
116
|
+
regions: z.array(z.string()).optional(),
|
|
117
|
+
entities: z.array(z.string()).optional(),
|
|
118
|
+
entityThresholds: z.record(z.number()).optional(),
|
|
119
|
+
threshold: z.number().optional(),
|
|
120
|
+
onFailure: OnFailure$outboundSchema.optional(),
|
|
121
|
+
}).transform((v) => {
|
|
122
|
+
return remap$(v, {
|
|
123
|
+
entityThresholds: "entity_thresholds",
|
|
124
|
+
onFailure: "on_failure",
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export function piiRedactionPluginToJSON(
|
|
129
|
+
piiRedactionPlugin: PIIRedactionPlugin,
|
|
130
|
+
): string {
|
|
131
|
+
return JSON.stringify(
|
|
132
|
+
PIIRedactionPlugin$outboundSchema.parse(piiRedactionPlugin),
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
export function piiRedactionPluginFromJSON(
|
|
136
|
+
jsonString: string,
|
|
137
|
+
): SafeParseResult<PIIRedactionPlugin, SDKValidationError> {
|
|
138
|
+
return safeParse(
|
|
139
|
+
jsonString,
|
|
140
|
+
(x) => PIIRedactionPlugin$inboundSchema.parse(JSON.parse(x)),
|
|
141
|
+
`Failed to parse 'PIIRedactionPlugin' from JSON`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -19,18 +19,6 @@ export const PublicPluginId = {
|
|
|
19
19
|
*/
|
|
20
20
|
export type PublicPluginId = ClosedEnum<typeof PublicPluginId>;
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* pii_redaction only. Detector language. Defaults to en.
|
|
24
|
-
*/
|
|
25
|
-
export const PublicPluginLanguage = {
|
|
26
|
-
En: "en",
|
|
27
|
-
Nl: "nl",
|
|
28
|
-
} as const;
|
|
29
|
-
/**
|
|
30
|
-
* pii_redaction only. Detector language. Defaults to en.
|
|
31
|
-
*/
|
|
32
|
-
export type PublicPluginLanguage = ClosedEnum<typeof PublicPluginLanguage>;
|
|
33
|
-
|
|
34
22
|
export const PublicPluginMask = {
|
|
35
23
|
All: "all",
|
|
36
24
|
System: "system",
|
|
@@ -55,17 +43,21 @@ export type PublicPluginOnFailure = ClosedEnum<typeof PublicPluginOnFailure>;
|
|
|
55
43
|
|
|
56
44
|
export type PublicPlugin = {
|
|
57
45
|
/**
|
|
58
|
-
* pii_redaction only. Entity types to redact (e.g. EMAIL_ADDRESS, BSN). Omit to redact every type detected for the language.
|
|
46
|
+
* pii_redaction only. Entity types to redact (e.g. EMAIL_ADDRESS, BSN). Omit to redact every type detected for the language and regions. Cannot be combined with regions.
|
|
59
47
|
*/
|
|
60
48
|
entities?: Array<string> | null | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* pii_redaction only. Per-entity confidence cutoff overrides in [0,1], keyed by entity type. An override replaces threshold for that type and may sit above or below it. Every key must also appear in entities.
|
|
51
|
+
*/
|
|
52
|
+
entityThresholds?: { [k: string]: number } | undefined;
|
|
61
53
|
/**
|
|
62
54
|
* Plugin discriminator. pii_redaction redacts PII, response_healing repairs malformed JSON, and trace_scrubbing removes selected sensitive fields from exported traces.
|
|
63
55
|
*/
|
|
64
56
|
id: PublicPluginId;
|
|
65
57
|
/**
|
|
66
|
-
* pii_redaction only. Detector language. Defaults to en.
|
|
58
|
+
* pii_redaction only. Detector language, or "auto" to detect it per request. Defaults to en. The accepted values are whatever GET /v2/pii/capabilities lists, so they are not enumerated here: a fixed enum would reject a language the detector has since added.
|
|
67
59
|
*/
|
|
68
|
-
language?:
|
|
60
|
+
language?: string | undefined;
|
|
69
61
|
/**
|
|
70
62
|
* trace_scrubbing only. Trace surfaces to scrub. At least one value required.
|
|
71
63
|
*/
|
|
@@ -74,6 +66,10 @@ export type PublicPlugin = {
|
|
|
74
66
|
* pii_redaction only. Behavior when redaction is unavailable. block (default) fails the request; passthrough sends the original text.
|
|
75
67
|
*/
|
|
76
68
|
onFailure?: PublicPluginOnFailure | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* pii_redaction only. Region codes gating regional recognizers (e.g. nl, gb). ["all"] is exclusive. Omit for base entities only. Cannot be combined with entities.
|
|
71
|
+
*/
|
|
72
|
+
regions?: Array<string> | null | undefined;
|
|
77
73
|
/**
|
|
78
74
|
* pii_redaction only. Detector confidence cutoff in [0,1].
|
|
79
75
|
*/
|
|
@@ -85,11 +81,6 @@ export const PublicPluginId$outboundSchema: z.ZodNativeEnum<
|
|
|
85
81
|
typeof PublicPluginId
|
|
86
82
|
> = z.nativeEnum(PublicPluginId);
|
|
87
83
|
|
|
88
|
-
/** @internal */
|
|
89
|
-
export const PublicPluginLanguage$outboundSchema: z.ZodNativeEnum<
|
|
90
|
-
typeof PublicPluginLanguage
|
|
91
|
-
> = z.nativeEnum(PublicPluginLanguage);
|
|
92
|
-
|
|
93
84
|
/** @internal */
|
|
94
85
|
export const PublicPluginMask$outboundSchema: z.ZodNativeEnum<
|
|
95
86
|
typeof PublicPluginMask
|
|
@@ -103,10 +94,12 @@ export const PublicPluginOnFailure$outboundSchema: z.ZodNativeEnum<
|
|
|
103
94
|
/** @internal */
|
|
104
95
|
export type PublicPlugin$Outbound = {
|
|
105
96
|
entities?: Array<string> | null | undefined;
|
|
97
|
+
entity_thresholds?: { [k: string]: number } | undefined;
|
|
106
98
|
id: string;
|
|
107
99
|
language?: string | undefined;
|
|
108
100
|
mask?: Array<string> | null | undefined;
|
|
109
101
|
on_failure?: string | undefined;
|
|
102
|
+
regions?: Array<string> | null | undefined;
|
|
110
103
|
threshold?: number | undefined;
|
|
111
104
|
};
|
|
112
105
|
|
|
@@ -117,13 +110,16 @@ export const PublicPlugin$outboundSchema: z.ZodType<
|
|
|
117
110
|
PublicPlugin
|
|
118
111
|
> = z.object({
|
|
119
112
|
entities: z.nullable(z.array(z.string())).optional(),
|
|
113
|
+
entityThresholds: z.record(z.number()).optional(),
|
|
120
114
|
id: PublicPluginId$outboundSchema,
|
|
121
|
-
language:
|
|
115
|
+
language: z.string().optional(),
|
|
122
116
|
mask: z.nullable(z.array(PublicPluginMask$outboundSchema)).optional(),
|
|
123
117
|
onFailure: PublicPluginOnFailure$outboundSchema.optional(),
|
|
118
|
+
regions: z.nullable(z.array(z.string())).optional(),
|
|
124
119
|
threshold: z.number().optional(),
|
|
125
120
|
}).transform((v) => {
|
|
126
121
|
return remap$(v, {
|
|
122
|
+
entityThresholds: "entity_thresholds",
|
|
127
123
|
onFailure: "on_failure",
|
|
128
124
|
});
|
|
129
125
|
});
|
|
@@ -40,7 +40,7 @@ export const ReasoningPart$inboundSchema: z.ZodType<
|
|
|
40
40
|
z.ZodTypeDef,
|
|
41
41
|
unknown
|
|
42
42
|
> = z.object({
|
|
43
|
-
_id: z.string().default("
|
|
43
|
+
_id: z.string().default("reasoning_01m1ny970yxt51fwq3537kvmda"),
|
|
44
44
|
metadata: z.record(z.any()).optional(),
|
|
45
45
|
kind: z.literal("reasoning"),
|
|
46
46
|
reasoning: z.string(),
|
|
@@ -3,11 +3,53 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
7
|
|
|
7
8
|
export type RedactRequest = {
|
|
8
9
|
text?: string | undefined;
|
|
9
10
|
language?: string | undefined;
|
|
10
11
|
threshold?: number | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Region codes selecting whole regions of coverage, e.g. "nl", "gb". Every
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* entity type those regions cover is included, alongside the base catalog.
|
|
17
|
+
* ["all"] is exclusive. Leaving this and `entities` both empty also runs every
|
|
18
|
+
* region, so selecting nothing is the widest request rather than the narrowest.
|
|
19
|
+
* Empty alongside a non-empty `entities` stays strict. See the capabilities
|
|
20
|
+
* endpoint for the region list.
|
|
21
|
+
*
|
|
22
|
+
* Combines with `entities`: the detector unions the two selections, so a
|
|
23
|
+
* request carrying both covers the regions plus the named types. Note that
|
|
24
|
+
* `entities` only narrows coverage when it travels alone.
|
|
25
|
+
*/
|
|
26
|
+
regions?: Array<string> | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The entity types to cover. A named type fires even when it belongs to a
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* region, so a region's types can be selected individually without naming
|
|
32
|
+
* the region. Alone this is a strict allowlist; alongside `regions` it adds
|
|
33
|
+
* to the region coverage instead of narrowing it.
|
|
34
|
+
*/
|
|
35
|
+
entities?: Array<string> | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Per-entity confidence cutoff overrides. An override REPLACES the global
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* `threshold` for that type and may sit above or below it: the gateway
|
|
41
|
+
* lowers the first-pass floor it sends the detector to the smallest value
|
|
42
|
+
* in the map, and every selected type carries its own cutoff, so a
|
|
43
|
+
* sub-global override detects MORE of that type without widening the rest.
|
|
44
|
+
*
|
|
45
|
+
* This only tunes confidence; it never changes which types are covered.
|
|
46
|
+
* Coverage is decided by `entities` alone, so every key here must also
|
|
47
|
+
* appear in `entities` — a key that does not is rejected, as is any key at
|
|
48
|
+
* all when `entities` is empty.
|
|
49
|
+
*
|
|
50
|
+
* Declarative [0,1] bound mirrors existing constraint on `threshold`.
|
|
51
|
+
*/
|
|
52
|
+
entityThresholds?: { [k: string]: number } | undefined;
|
|
11
53
|
};
|
|
12
54
|
|
|
13
55
|
/** @internal */
|
|
@@ -15,6 +57,9 @@ export type RedactRequest$Outbound = {
|
|
|
15
57
|
text?: string | undefined;
|
|
16
58
|
language?: string | undefined;
|
|
17
59
|
threshold?: number | undefined;
|
|
60
|
+
regions?: Array<string> | undefined;
|
|
61
|
+
entities?: Array<string> | undefined;
|
|
62
|
+
entity_thresholds?: { [k: string]: number } | undefined;
|
|
18
63
|
};
|
|
19
64
|
|
|
20
65
|
/** @internal */
|
|
@@ -26,6 +71,13 @@ export const RedactRequest$outboundSchema: z.ZodType<
|
|
|
26
71
|
text: z.string().optional(),
|
|
27
72
|
language: z.string().optional(),
|
|
28
73
|
threshold: z.number().optional(),
|
|
74
|
+
regions: z.array(z.string()).optional(),
|
|
75
|
+
entities: z.array(z.string()).optional(),
|
|
76
|
+
entityThresholds: z.record(z.number()).optional(),
|
|
77
|
+
}).transform((v) => {
|
|
78
|
+
return remap$(v, {
|
|
79
|
+
entityThresholds: "entity_thresholds",
|
|
80
|
+
});
|
|
29
81
|
});
|
|
30
82
|
|
|
31
83
|
export function redactRequestToJSON(redactRequest: RedactRequest): string {
|
|
@@ -4,50 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { ClosedEnum } from "../../types/enums.js";
|
|
8
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
9
|
|
|
11
|
-
/**
|
|
12
|
-
* Plugin discriminator. Must be `response_healing`.
|
|
13
|
-
*/
|
|
14
|
-
export const ResponseHealingPluginId = {
|
|
15
|
-
ResponseHealing: "response_healing",
|
|
16
|
-
} as const;
|
|
17
|
-
/**
|
|
18
|
-
* Plugin discriminator. Must be `response_healing`.
|
|
19
|
-
*/
|
|
20
|
-
export type ResponseHealingPluginId = ClosedEnum<
|
|
21
|
-
typeof ResponseHealingPluginId
|
|
22
|
-
>;
|
|
23
|
-
|
|
24
10
|
export type ResponseHealingPlugin = {
|
|
25
11
|
/**
|
|
26
12
|
* Plugin discriminator. Must be `response_healing`.
|
|
27
13
|
*/
|
|
28
|
-
id:
|
|
14
|
+
id: "response_healing";
|
|
29
15
|
};
|
|
30
16
|
|
|
31
|
-
/** @internal */
|
|
32
|
-
export const ResponseHealingPluginId$inboundSchema: z.ZodNativeEnum<
|
|
33
|
-
typeof ResponseHealingPluginId
|
|
34
|
-
> = z.nativeEnum(ResponseHealingPluginId);
|
|
35
|
-
/** @internal */
|
|
36
|
-
export const ResponseHealingPluginId$outboundSchema: z.ZodNativeEnum<
|
|
37
|
-
typeof ResponseHealingPluginId
|
|
38
|
-
> = ResponseHealingPluginId$inboundSchema;
|
|
39
|
-
|
|
40
17
|
/** @internal */
|
|
41
18
|
export const ResponseHealingPlugin$inboundSchema: z.ZodType<
|
|
42
19
|
ResponseHealingPlugin,
|
|
43
20
|
z.ZodTypeDef,
|
|
44
21
|
unknown
|
|
45
22
|
> = z.object({
|
|
46
|
-
id:
|
|
23
|
+
id: z.literal("response_healing"),
|
|
47
24
|
});
|
|
48
25
|
/** @internal */
|
|
49
26
|
export type ResponseHealingPlugin$Outbound = {
|
|
50
|
-
id:
|
|
27
|
+
id: "response_healing";
|
|
51
28
|
};
|
|
52
29
|
|
|
53
30
|
/** @internal */
|
|
@@ -56,7 +33,7 @@ export const ResponseHealingPlugin$outboundSchema: z.ZodType<
|
|
|
56
33
|
z.ZodTypeDef,
|
|
57
34
|
ResponseHealingPlugin
|
|
58
35
|
> = z.object({
|
|
59
|
-
id:
|
|
36
|
+
id: z.literal("response_healing"),
|
|
60
37
|
});
|
|
61
38
|
|
|
62
39
|
export function responseHealingPluginToJSON(
|
|
@@ -13,11 +13,30 @@ export type RoutingRulePlugin = {
|
|
|
13
13
|
* Plugin discriminator.
|
|
14
14
|
*/
|
|
15
15
|
id?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Languages, regions and entity types are checked against the live
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* pii-detection capabilities catalog when the rule is saved, not pinned
|
|
21
|
+
* here, so a language or region the detector gains becomes writable without
|
|
22
|
+
* a proto change.
|
|
23
|
+
*/
|
|
16
24
|
language?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Entity types to redact. Mutually exclusive with regions.
|
|
27
|
+
*/
|
|
17
28
|
entities?: Array<string> | undefined;
|
|
18
29
|
onFailure?: string | undefined;
|
|
19
30
|
threshold?: number | undefined;
|
|
20
31
|
mask?: Array<string> | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Regions of coverage by ISO 3166-1 alpha-2 code, or ["all"]. Mutually exclusive with entities.
|
|
34
|
+
*/
|
|
35
|
+
regions?: Array<string> | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Per-entity-type confidence cutoff. Every key must also appear in entities.
|
|
38
|
+
*/
|
|
39
|
+
entityThresholds?: { [k: string]: number } | undefined;
|
|
21
40
|
};
|
|
22
41
|
|
|
23
42
|
/** @internal */
|
|
@@ -32,9 +51,12 @@ export const RoutingRulePlugin$inboundSchema: z.ZodType<
|
|
|
32
51
|
on_failure: z.string().optional(),
|
|
33
52
|
threshold: z.number().optional(),
|
|
34
53
|
mask: z.array(z.string()).optional(),
|
|
54
|
+
regions: z.array(z.string()).optional(),
|
|
55
|
+
entity_thresholds: z.record(z.number()).optional(),
|
|
35
56
|
}).transform((v) => {
|
|
36
57
|
return remap$(v, {
|
|
37
58
|
"on_failure": "onFailure",
|
|
59
|
+
"entity_thresholds": "entityThresholds",
|
|
38
60
|
});
|
|
39
61
|
});
|
|
40
62
|
/** @internal */
|
|
@@ -45,6 +67,8 @@ export type RoutingRulePlugin$Outbound = {
|
|
|
45
67
|
on_failure?: string | undefined;
|
|
46
68
|
threshold?: number | undefined;
|
|
47
69
|
mask?: Array<string> | undefined;
|
|
70
|
+
regions?: Array<string> | undefined;
|
|
71
|
+
entity_thresholds?: { [k: string]: number } | undefined;
|
|
48
72
|
};
|
|
49
73
|
|
|
50
74
|
/** @internal */
|
|
@@ -59,9 +83,12 @@ export const RoutingRulePlugin$outboundSchema: z.ZodType<
|
|
|
59
83
|
onFailure: z.string().optional(),
|
|
60
84
|
threshold: z.number().optional(),
|
|
61
85
|
mask: z.array(z.string()).optional(),
|
|
86
|
+
regions: z.array(z.string()).optional(),
|
|
87
|
+
entityThresholds: z.record(z.number()).optional(),
|
|
62
88
|
}).transform((v) => {
|
|
63
89
|
return remap$(v, {
|
|
64
90
|
onFailure: "on_failure",
|
|
91
|
+
entityThresholds: "entity_thresholds",
|
|
65
92
|
});
|
|
66
93
|
});
|
|
67
94
|
|