@meetkai/mka1 0.55.26 → 0.55.27
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/bin/mcp-server.js +106 -10
- package/bin/mcp-server.js.map +14 -13
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/models/components/banwordsguardrail.d.ts +27 -0
- package/dist/commonjs/models/components/banwordsguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/banwordsguardrail.js +21 -1
- package/dist/commonjs/models/components/banwordsguardrail.js.map +1 -1
- package/dist/commonjs/models/components/classifierguardrail.d.ts +27 -0
- package/dist/commonjs/models/components/classifierguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/classifierguardrail.js +21 -1
- package/dist/commonjs/models/components/classifierguardrail.js.map +1 -1
- package/dist/commonjs/models/components/clusterdefaultrulesummary.d.ts +21 -0
- package/dist/commonjs/models/components/clusterdefaultrulesummary.d.ts.map +1 -1
- package/dist/commonjs/models/components/clusterdefaultrulesummary.js +16 -1
- package/dist/commonjs/models/components/clusterdefaultrulesummary.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/leakageguardrail.d.ts +27 -0
- package/dist/commonjs/models/components/leakageguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/leakageguardrail.js +21 -1
- package/dist/commonjs/models/components/leakageguardrail.js.map +1 -1
- package/dist/commonjs/models/components/outputwindow.d.ts +28 -0
- package/dist/commonjs/models/components/outputwindow.d.ts.map +1 -0
- package/dist/commonjs/models/components/outputwindow.js +71 -0
- package/dist/commonjs/models/components/outputwindow.js.map +1 -0
- package/dist/commonjs/models/components/promptinjectionguardrail.d.ts +27 -0
- package/dist/commonjs/models/components/promptinjectionguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/promptinjectionguardrail.js +21 -1
- package/dist/commonjs/models/components/promptinjectionguardrail.js.map +1 -1
- package/dist/commonjs/models/components/tooldefinition.d.ts +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/models/components/banwordsguardrail.d.ts +27 -0
- package/dist/esm/models/components/banwordsguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/banwordsguardrail.js +20 -0
- package/dist/esm/models/components/banwordsguardrail.js.map +1 -1
- package/dist/esm/models/components/classifierguardrail.d.ts +27 -0
- package/dist/esm/models/components/classifierguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/classifierguardrail.js +20 -0
- package/dist/esm/models/components/classifierguardrail.js.map +1 -1
- package/dist/esm/models/components/clusterdefaultrulesummary.d.ts +21 -0
- package/dist/esm/models/components/clusterdefaultrulesummary.d.ts.map +1 -1
- package/dist/esm/models/components/clusterdefaultrulesummary.js +15 -0
- package/dist/esm/models/components/clusterdefaultrulesummary.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/leakageguardrail.d.ts +27 -0
- package/dist/esm/models/components/leakageguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/leakageguardrail.js +20 -0
- package/dist/esm/models/components/leakageguardrail.js.map +1 -1
- package/dist/esm/models/components/outputwindow.d.ts +28 -0
- package/dist/esm/models/components/outputwindow.d.ts.map +1 -0
- package/dist/esm/models/components/outputwindow.js +33 -0
- package/dist/esm/models/components/outputwindow.js.map +1 -0
- package/dist/esm/models/components/promptinjectionguardrail.d.ts +27 -0
- package/dist/esm/models/components/promptinjectionguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/promptinjectionguardrail.js +20 -0
- package/dist/esm/models/components/promptinjectionguardrail.js.map +1 -1
- package/dist/esm/models/components/tooldefinition.d.ts +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/banwordsguardrail.ts +44 -0
- package/src/models/components/classifierguardrail.ts +48 -0
- package/src/models/components/clusterdefaultrulesummary.ts +34 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/components/leakageguardrail.ts +48 -0
- package/src/models/components/outputwindow.ts +71 -0
- package/src/models/components/promptinjectionguardrail.ts +49 -0
- package/src/models/components/tooldefinition.ts +1 -1
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import * as z from "zod/v3";
|
|
2
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
2
3
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
4
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
5
|
import { GuardrailInputSource } from "./guardrailinputsource.js";
|
|
6
|
+
import { OutputWindow, OutputWindow$Outbound } from "./outputwindow.js";
|
|
5
7
|
import { PromptInjectionConfig, PromptInjectionConfig$Outbound } from "./promptinjectionconfig.js";
|
|
8
|
+
/**
|
|
9
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
10
|
+
*/
|
|
11
|
+
export declare const PromptInjectionGuardrailOutputTiming: {
|
|
12
|
+
readonly Final: "final";
|
|
13
|
+
readonly Streaming: "streaming";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
17
|
+
*/
|
|
18
|
+
export type PromptInjectionGuardrailOutputTiming = ClosedEnum<typeof PromptInjectionGuardrailOutputTiming>;
|
|
6
19
|
/**
|
|
7
20
|
* Prompt injection guardrail
|
|
8
21
|
*/
|
|
@@ -16,6 +29,14 @@ export type PromptInjectionGuardrail = {
|
|
|
16
29
|
* Also apply this guardrail to model output, not just the request
|
|
17
30
|
*/
|
|
18
31
|
checkOutput?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
34
|
+
*/
|
|
35
|
+
outputTiming?: PromptInjectionGuardrailOutputTiming | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* When a streaming output check runs: whichever of max_chars and max_ms fills first
|
|
38
|
+
*/
|
|
39
|
+
outputWindow?: OutputWindow | undefined;
|
|
19
40
|
/**
|
|
20
41
|
* Request sources this guardrail checks before they reach the model. Omit to use the mode's default: every source for classifier; every source except system for ban_words, since instructions often name the terms they forbid; only what the user sends for prompt_injection and leakage, whose keyword patterns match ordinary instructions, replies and documents. An empty list checks no input, so the rule only checks output when check_output is set. Rules saved before this field existed were set to user messages only.
|
|
21
42
|
*/
|
|
@@ -26,12 +47,18 @@ export type PromptInjectionGuardrail = {
|
|
|
26
47
|
config?: PromptInjectionConfig | undefined;
|
|
27
48
|
};
|
|
28
49
|
/** @internal */
|
|
50
|
+
export declare const PromptInjectionGuardrailOutputTiming$inboundSchema: z.ZodNativeEnum<typeof PromptInjectionGuardrailOutputTiming>;
|
|
51
|
+
/** @internal */
|
|
52
|
+
export declare const PromptInjectionGuardrailOutputTiming$outboundSchema: z.ZodNativeEnum<typeof PromptInjectionGuardrailOutputTiming>;
|
|
53
|
+
/** @internal */
|
|
29
54
|
export declare const PromptInjectionGuardrail$inboundSchema: z.ZodType<PromptInjectionGuardrail, z.ZodTypeDef, unknown>;
|
|
30
55
|
/** @internal */
|
|
31
56
|
export type PromptInjectionGuardrail$Outbound = {
|
|
32
57
|
mode: "prompt_injection";
|
|
33
58
|
enabled: boolean;
|
|
34
59
|
check_output?: boolean | undefined;
|
|
60
|
+
output_timing?: string | undefined;
|
|
61
|
+
output_window?: OutputWindow$Outbound | undefined;
|
|
35
62
|
input_sources?: Array<string> | undefined;
|
|
36
63
|
config?: PromptInjectionConfig$Outbound | undefined;
|
|
37
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptinjectionguardrail.d.ts","sourceRoot":"","sources":["../../../../src/models/components/promptinjectionguardrail.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,oBAAoB,EAGrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,EAErB,8BAA8B,EAE/B,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,kBAAkB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;IACvD;;OAEG;IACH,MAAM,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC5C,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,sCAAsC,EAAE,CAAC,CAAC,OAAO,CAC5D,wBAAwB,EACxB,CAAC,CAAC,UAAU,EACZ,OAAO,
|
|
1
|
+
{"version":3,"file":"promptinjectionguardrail.d.ts","sourceRoot":"","sources":["../../../../src/models/components/promptinjectionguardrail.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,oBAAoB,EAGrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,EAEZ,qBAAqB,EAEtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EAErB,8BAA8B,EAE/B,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;CAGvC,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,UAAU,CAC3D,OAAO,oCAAoC,CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,kBAAkB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,oCAAoC,GAAG,SAAS,CAAC;IAChE;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;IACvD;;OAEG;IACH,MAAM,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC5C,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,kDAAkD,EAC7D,CAAC,CAAC,aAAa,CAAC,OAAO,oCAAoC,CAE1D,CAAC;AACJ,gBAAgB;AAChB,eAAO,MAAM,mDAAmD,EAC9D,CAAC,CAAC,aAAa,CAAC,OAAO,oCAAoC,CACP,CAAC;AAEvD,gBAAgB;AAChB,eAAO,MAAM,sCAAsC,EAAE,CAAC,CAAC,OAAO,CAC5D,wBAAwB,EACxB,CAAC,CAAC,UAAU,EACZ,OAAO,CAgBP,CAAC;AACH,gBAAgB;AAChB,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAClD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1C,MAAM,CAAC,EAAE,8BAA8B,GAAG,SAAS,CAAC;CACrD,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,uCAAuC,EAAE,CAAC,CAAC,OAAO,CAC7D,iCAAiC,EACjC,CAAC,CAAC,UAAU,EACZ,wBAAwB,CAgBxB,CAAC;AAEH,wBAAgB,8BAA8B,CAC5C,wBAAwB,EAAE,wBAAwB,GACjD,MAAM,CAIR;AACD,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,wBAAwB,EAAE,kBAAkB,CAAC,CAM/D"}
|
|
@@ -5,17 +5,33 @@ import * as z from "zod/v3";
|
|
|
5
5
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
7
7
|
import { GuardrailInputSource$inboundSchema, GuardrailInputSource$outboundSchema, } from "./guardrailinputsource.js";
|
|
8
|
+
import { OutputWindow$inboundSchema, OutputWindow$outboundSchema, } from "./outputwindow.js";
|
|
8
9
|
import { PromptInjectionConfig$inboundSchema, PromptInjectionConfig$outboundSchema, } from "./promptinjectionconfig.js";
|
|
10
|
+
/**
|
|
11
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
12
|
+
*/
|
|
13
|
+
export const PromptInjectionGuardrailOutputTiming = {
|
|
14
|
+
Final: "final",
|
|
15
|
+
Streaming: "streaming",
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const PromptInjectionGuardrailOutputTiming$inboundSchema = z.nativeEnum(PromptInjectionGuardrailOutputTiming);
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const PromptInjectionGuardrailOutputTiming$outboundSchema = PromptInjectionGuardrailOutputTiming$inboundSchema;
|
|
9
21
|
/** @internal */
|
|
10
22
|
export const PromptInjectionGuardrail$inboundSchema = z.object({
|
|
11
23
|
mode: z.literal("prompt_injection"),
|
|
12
24
|
enabled: z.boolean().default(true),
|
|
13
25
|
check_output: z.boolean().optional(),
|
|
26
|
+
output_timing: PromptInjectionGuardrailOutputTiming$inboundSchema.optional(),
|
|
27
|
+
output_window: OutputWindow$inboundSchema.optional(),
|
|
14
28
|
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
15
29
|
config: PromptInjectionConfig$inboundSchema.optional(),
|
|
16
30
|
}).transform((v) => {
|
|
17
31
|
return remap$(v, {
|
|
18
32
|
"check_output": "checkOutput",
|
|
33
|
+
"output_timing": "outputTiming",
|
|
34
|
+
"output_window": "outputWindow",
|
|
19
35
|
"input_sources": "inputSources",
|
|
20
36
|
});
|
|
21
37
|
});
|
|
@@ -24,11 +40,15 @@ export const PromptInjectionGuardrail$outboundSchema = z.object({
|
|
|
24
40
|
mode: z.literal("prompt_injection"),
|
|
25
41
|
enabled: z.boolean().default(true),
|
|
26
42
|
checkOutput: z.boolean().optional(),
|
|
43
|
+
outputTiming: PromptInjectionGuardrailOutputTiming$outboundSchema.optional(),
|
|
44
|
+
outputWindow: OutputWindow$outboundSchema.optional(),
|
|
27
45
|
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
28
46
|
config: PromptInjectionConfig$outboundSchema.optional(),
|
|
29
47
|
}).transform((v) => {
|
|
30
48
|
return remap$(v, {
|
|
31
49
|
checkOutput: "check_output",
|
|
50
|
+
outputTiming: "output_timing",
|
|
51
|
+
outputWindow: "output_window",
|
|
32
52
|
inputSources: "input_sources",
|
|
33
53
|
});
|
|
34
54
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptinjectionguardrail.js","sourceRoot":"","sources":["../../../../src/models/components/promptinjectionguardrail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"promptinjectionguardrail.js","sourceRoot":"","sources":["../../../../src/models/components/promptinjectionguardrail.ts"],"names":[],"mappings":"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"}
|
|
@@ -69,7 +69,7 @@ export declare const ToolDefinition9Type: {
|
|
|
69
69
|
};
|
|
70
70
|
export type ToolDefinition9Type = ClosedEnum<typeof ToolDefinition9Type>;
|
|
71
71
|
/**
|
|
72
|
-
* Another saved agent of the same team, called as a tool.
|
|
72
|
+
* Another saved agent of the same team, called as a tool. The Responses API starts a run of that agent and returns its answer.
|
|
73
73
|
*/
|
|
74
74
|
export type Nine = {
|
|
75
75
|
type: ToolDefinition9Type;
|
package/jsr.json
CHANGED
package/package.json
CHANGED
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "1.1.0",
|
|
68
|
-
sdkVersion: "0.55.
|
|
68
|
+
sdkVersion: "0.55.27",
|
|
69
69
|
genVersion: "2.950.2",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.55.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.55.27 2.950.2 1.1.0 @meetkai/mka1",
|
|
71
71
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
11
|
import {
|
|
@@ -18,6 +19,24 @@ import {
|
|
|
18
19
|
GuardrailInputSource$inboundSchema,
|
|
19
20
|
GuardrailInputSource$outboundSchema,
|
|
20
21
|
} from "./guardrailinputsource.js";
|
|
22
|
+
import {
|
|
23
|
+
OutputWindow,
|
|
24
|
+
OutputWindow$inboundSchema,
|
|
25
|
+
OutputWindow$Outbound,
|
|
26
|
+
OutputWindow$outboundSchema,
|
|
27
|
+
} from "./outputwindow.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
31
|
+
*/
|
|
32
|
+
export const OutputTiming = {
|
|
33
|
+
Final: "final",
|
|
34
|
+
Streaming: "streaming",
|
|
35
|
+
} as const;
|
|
36
|
+
/**
|
|
37
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
38
|
+
*/
|
|
39
|
+
export type OutputTiming = ClosedEnum<typeof OutputTiming>;
|
|
21
40
|
|
|
22
41
|
/**
|
|
23
42
|
* Banned words guardrail
|
|
@@ -32,6 +51,14 @@ export type BanWordsGuardrail = {
|
|
|
32
51
|
* Also apply this guardrail to model output, not just the request
|
|
33
52
|
*/
|
|
34
53
|
checkOutput?: boolean | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
56
|
+
*/
|
|
57
|
+
outputTiming?: OutputTiming | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* When a streaming output check runs: whichever of max_chars and max_ms fills first
|
|
60
|
+
*/
|
|
61
|
+
outputWindow?: OutputWindow | undefined;
|
|
35
62
|
/**
|
|
36
63
|
* Request sources this guardrail checks before they reach the model. Omit to use the mode's default: every source for classifier; every source except system for ban_words, since instructions often name the terms they forbid; only what the user sends for prompt_injection and leakage, whose keyword patterns match ordinary instructions, replies and documents. An empty list checks no input, so the rule only checks output when check_output is set. Rules saved before this field existed were set to user messages only.
|
|
37
64
|
*/
|
|
@@ -42,6 +69,13 @@ export type BanWordsGuardrail = {
|
|
|
42
69
|
config?: BanWordsConfig | undefined;
|
|
43
70
|
};
|
|
44
71
|
|
|
72
|
+
/** @internal */
|
|
73
|
+
export const OutputTiming$inboundSchema: z.ZodNativeEnum<typeof OutputTiming> =
|
|
74
|
+
z.nativeEnum(OutputTiming);
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const OutputTiming$outboundSchema: z.ZodNativeEnum<typeof OutputTiming> =
|
|
77
|
+
OutputTiming$inboundSchema;
|
|
78
|
+
|
|
45
79
|
/** @internal */
|
|
46
80
|
export const BanWordsGuardrail$inboundSchema: z.ZodType<
|
|
47
81
|
BanWordsGuardrail,
|
|
@@ -51,11 +85,15 @@ export const BanWordsGuardrail$inboundSchema: z.ZodType<
|
|
|
51
85
|
mode: z.literal("ban_words"),
|
|
52
86
|
enabled: z.boolean().default(true),
|
|
53
87
|
check_output: z.boolean().optional(),
|
|
88
|
+
output_timing: OutputTiming$inboundSchema.optional(),
|
|
89
|
+
output_window: OutputWindow$inboundSchema.optional(),
|
|
54
90
|
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
55
91
|
config: BanWordsConfig$inboundSchema.optional(),
|
|
56
92
|
}).transform((v) => {
|
|
57
93
|
return remap$(v, {
|
|
58
94
|
"check_output": "checkOutput",
|
|
95
|
+
"output_timing": "outputTiming",
|
|
96
|
+
"output_window": "outputWindow",
|
|
59
97
|
"input_sources": "inputSources",
|
|
60
98
|
});
|
|
61
99
|
});
|
|
@@ -64,6 +102,8 @@ export type BanWordsGuardrail$Outbound = {
|
|
|
64
102
|
mode: "ban_words";
|
|
65
103
|
enabled: boolean;
|
|
66
104
|
check_output?: boolean | undefined;
|
|
105
|
+
output_timing?: string | undefined;
|
|
106
|
+
output_window?: OutputWindow$Outbound | undefined;
|
|
67
107
|
input_sources?: Array<string> | undefined;
|
|
68
108
|
config?: BanWordsConfig$Outbound | undefined;
|
|
69
109
|
};
|
|
@@ -77,11 +117,15 @@ export const BanWordsGuardrail$outboundSchema: z.ZodType<
|
|
|
77
117
|
mode: z.literal("ban_words"),
|
|
78
118
|
enabled: z.boolean().default(true),
|
|
79
119
|
checkOutput: z.boolean().optional(),
|
|
120
|
+
outputTiming: OutputTiming$outboundSchema.optional(),
|
|
121
|
+
outputWindow: OutputWindow$outboundSchema.optional(),
|
|
80
122
|
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
81
123
|
config: BanWordsConfig$outboundSchema.optional(),
|
|
82
124
|
}).transform((v) => {
|
|
83
125
|
return remap$(v, {
|
|
84
126
|
checkOutput: "check_output",
|
|
127
|
+
outputTiming: "output_timing",
|
|
128
|
+
outputWindow: "output_window",
|
|
85
129
|
inputSources: "input_sources",
|
|
86
130
|
});
|
|
87
131
|
});
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
11
|
import {
|
|
@@ -18,6 +19,26 @@ import {
|
|
|
18
19
|
GuardrailInputSource$inboundSchema,
|
|
19
20
|
GuardrailInputSource$outboundSchema,
|
|
20
21
|
} from "./guardrailinputsource.js";
|
|
22
|
+
import {
|
|
23
|
+
OutputWindow,
|
|
24
|
+
OutputWindow$inboundSchema,
|
|
25
|
+
OutputWindow$Outbound,
|
|
26
|
+
OutputWindow$outboundSchema,
|
|
27
|
+
} from "./outputwindow.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
31
|
+
*/
|
|
32
|
+
export const ClassifierGuardrailOutputTiming = {
|
|
33
|
+
Final: "final",
|
|
34
|
+
Streaming: "streaming",
|
|
35
|
+
} as const;
|
|
36
|
+
/**
|
|
37
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
38
|
+
*/
|
|
39
|
+
export type ClassifierGuardrailOutputTiming = ClosedEnum<
|
|
40
|
+
typeof ClassifierGuardrailOutputTiming
|
|
41
|
+
>;
|
|
21
42
|
|
|
22
43
|
export type ClassifierGuardrail = {
|
|
23
44
|
mode: "classifier";
|
|
@@ -29,6 +50,14 @@ export type ClassifierGuardrail = {
|
|
|
29
50
|
* Also apply this guardrail to model output, not just the request
|
|
30
51
|
*/
|
|
31
52
|
checkOutput?: boolean | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
55
|
+
*/
|
|
56
|
+
outputTiming?: ClassifierGuardrailOutputTiming | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* When a streaming output check runs: whichever of max_chars and max_ms fills first
|
|
59
|
+
*/
|
|
60
|
+
outputWindow?: OutputWindow | undefined;
|
|
32
61
|
/**
|
|
33
62
|
* Request sources this guardrail checks before they reach the model. Omit to use the mode's default: every source for classifier; every source except system for ban_words, since instructions often name the terms they forbid; only what the user sends for prompt_injection and leakage, whose keyword patterns match ordinary instructions, replies and documents. An empty list checks no input, so the rule only checks output when check_output is set. Rules saved before this field existed were set to user messages only.
|
|
34
63
|
*/
|
|
@@ -36,6 +65,15 @@ export type ClassifierGuardrail = {
|
|
|
36
65
|
config: ClassifierConfig;
|
|
37
66
|
};
|
|
38
67
|
|
|
68
|
+
/** @internal */
|
|
69
|
+
export const ClassifierGuardrailOutputTiming$inboundSchema: z.ZodNativeEnum<
|
|
70
|
+
typeof ClassifierGuardrailOutputTiming
|
|
71
|
+
> = z.nativeEnum(ClassifierGuardrailOutputTiming);
|
|
72
|
+
/** @internal */
|
|
73
|
+
export const ClassifierGuardrailOutputTiming$outboundSchema: z.ZodNativeEnum<
|
|
74
|
+
typeof ClassifierGuardrailOutputTiming
|
|
75
|
+
> = ClassifierGuardrailOutputTiming$inboundSchema;
|
|
76
|
+
|
|
39
77
|
/** @internal */
|
|
40
78
|
export const ClassifierGuardrail$inboundSchema: z.ZodType<
|
|
41
79
|
ClassifierGuardrail,
|
|
@@ -45,11 +83,15 @@ export const ClassifierGuardrail$inboundSchema: z.ZodType<
|
|
|
45
83
|
mode: z.literal("classifier"),
|
|
46
84
|
enabled: z.boolean().default(true),
|
|
47
85
|
check_output: z.boolean().optional(),
|
|
86
|
+
output_timing: ClassifierGuardrailOutputTiming$inboundSchema.optional(),
|
|
87
|
+
output_window: OutputWindow$inboundSchema.optional(),
|
|
48
88
|
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
49
89
|
config: ClassifierConfig$inboundSchema,
|
|
50
90
|
}).transform((v) => {
|
|
51
91
|
return remap$(v, {
|
|
52
92
|
"check_output": "checkOutput",
|
|
93
|
+
"output_timing": "outputTiming",
|
|
94
|
+
"output_window": "outputWindow",
|
|
53
95
|
"input_sources": "inputSources",
|
|
54
96
|
});
|
|
55
97
|
});
|
|
@@ -58,6 +100,8 @@ export type ClassifierGuardrail$Outbound = {
|
|
|
58
100
|
mode: "classifier";
|
|
59
101
|
enabled: boolean;
|
|
60
102
|
check_output?: boolean | undefined;
|
|
103
|
+
output_timing?: string | undefined;
|
|
104
|
+
output_window?: OutputWindow$Outbound | undefined;
|
|
61
105
|
input_sources?: Array<string> | undefined;
|
|
62
106
|
config: ClassifierConfig$Outbound;
|
|
63
107
|
};
|
|
@@ -71,11 +115,15 @@ export const ClassifierGuardrail$outboundSchema: z.ZodType<
|
|
|
71
115
|
mode: z.literal("classifier"),
|
|
72
116
|
enabled: z.boolean().default(true),
|
|
73
117
|
checkOutput: z.boolean().optional(),
|
|
118
|
+
outputTiming: ClassifierGuardrailOutputTiming$outboundSchema.optional(),
|
|
119
|
+
outputWindow: OutputWindow$outboundSchema.optional(),
|
|
74
120
|
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
75
121
|
config: ClassifierConfig$outboundSchema,
|
|
76
122
|
}).transform((v) => {
|
|
77
123
|
return remap$(v, {
|
|
78
124
|
checkOutput: "check_output",
|
|
125
|
+
outputTiming: "output_timing",
|
|
126
|
+
outputWindow: "output_window",
|
|
79
127
|
inputSources: "input_sources",
|
|
80
128
|
});
|
|
81
129
|
});
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
11
|
import {
|
|
@@ -18,6 +19,20 @@ import {
|
|
|
18
19
|
GuardrailMode$outboundSchema,
|
|
19
20
|
} from "./guardrailmode.js";
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* When this guardrail checks model output: once on the finished text (final, the default) or while it streams
|
|
24
|
+
*/
|
|
25
|
+
export const ClusterDefaultRuleSummaryOutputTiming = {
|
|
26
|
+
Final: "final",
|
|
27
|
+
Streaming: "streaming",
|
|
28
|
+
} as const;
|
|
29
|
+
/**
|
|
30
|
+
* When this guardrail checks model output: once on the finished text (final, the default) or while it streams
|
|
31
|
+
*/
|
|
32
|
+
export type ClusterDefaultRuleSummaryOutputTiming = ClosedEnum<
|
|
33
|
+
typeof ClusterDefaultRuleSummaryOutputTiming
|
|
34
|
+
>;
|
|
35
|
+
|
|
21
36
|
/**
|
|
22
37
|
* A cluster default guardrail, without the operator's configuration
|
|
23
38
|
*/
|
|
@@ -28,6 +43,10 @@ export type ClusterDefaultRuleSummary = {
|
|
|
28
43
|
* Whether this guardrail also checks model output
|
|
29
44
|
*/
|
|
30
45
|
checkOutput?: boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* When this guardrail checks model output: once on the finished text (final, the default) or while it streams
|
|
48
|
+
*/
|
|
49
|
+
outputTiming?: ClusterDefaultRuleSummaryOutputTiming | undefined;
|
|
31
50
|
/**
|
|
32
51
|
* Request sources this guardrail checks
|
|
33
52
|
*/
|
|
@@ -38,6 +57,16 @@ export type ClusterDefaultRuleSummary = {
|
|
|
38
57
|
rejectionMessage?: string | undefined;
|
|
39
58
|
};
|
|
40
59
|
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const ClusterDefaultRuleSummaryOutputTiming$inboundSchema:
|
|
62
|
+
z.ZodNativeEnum<typeof ClusterDefaultRuleSummaryOutputTiming> = z.nativeEnum(
|
|
63
|
+
ClusterDefaultRuleSummaryOutputTiming,
|
|
64
|
+
);
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const ClusterDefaultRuleSummaryOutputTiming$outboundSchema:
|
|
67
|
+
z.ZodNativeEnum<typeof ClusterDefaultRuleSummaryOutputTiming> =
|
|
68
|
+
ClusterDefaultRuleSummaryOutputTiming$inboundSchema;
|
|
69
|
+
|
|
41
70
|
/** @internal */
|
|
42
71
|
export const ClusterDefaultRuleSummary$inboundSchema: z.ZodType<
|
|
43
72
|
ClusterDefaultRuleSummary,
|
|
@@ -47,11 +76,13 @@ export const ClusterDefaultRuleSummary$inboundSchema: z.ZodType<
|
|
|
47
76
|
mode: GuardrailMode$inboundSchema,
|
|
48
77
|
enabled: z.boolean(),
|
|
49
78
|
check_output: z.boolean().optional(),
|
|
79
|
+
output_timing: ClusterDefaultRuleSummaryOutputTiming$inboundSchema.optional(),
|
|
50
80
|
input_sources: z.array(GuardrailInputSource$inboundSchema),
|
|
51
81
|
rejection_message: z.string().optional(),
|
|
52
82
|
}).transform((v) => {
|
|
53
83
|
return remap$(v, {
|
|
54
84
|
"check_output": "checkOutput",
|
|
85
|
+
"output_timing": "outputTiming",
|
|
55
86
|
"input_sources": "inputSources",
|
|
56
87
|
"rejection_message": "rejectionMessage",
|
|
57
88
|
});
|
|
@@ -61,6 +92,7 @@ export type ClusterDefaultRuleSummary$Outbound = {
|
|
|
61
92
|
mode: string;
|
|
62
93
|
enabled: boolean;
|
|
63
94
|
check_output?: boolean | undefined;
|
|
95
|
+
output_timing?: string | undefined;
|
|
64
96
|
input_sources: Array<string>;
|
|
65
97
|
rejection_message?: string | undefined;
|
|
66
98
|
};
|
|
@@ -74,11 +106,13 @@ export const ClusterDefaultRuleSummary$outboundSchema: z.ZodType<
|
|
|
74
106
|
mode: GuardrailMode$outboundSchema,
|
|
75
107
|
enabled: z.boolean(),
|
|
76
108
|
checkOutput: z.boolean().optional(),
|
|
109
|
+
outputTiming: ClusterDefaultRuleSummaryOutputTiming$outboundSchema.optional(),
|
|
77
110
|
inputSources: z.array(GuardrailInputSource$outboundSchema),
|
|
78
111
|
rejectionMessage: z.string().optional(),
|
|
79
112
|
}).transform((v) => {
|
|
80
113
|
return remap$(v, {
|
|
81
114
|
checkOutput: "check_output",
|
|
115
|
+
outputTiming: "output_timing",
|
|
82
116
|
inputSources: "input_sources",
|
|
83
117
|
rejectionMessage: "rejection_message",
|
|
84
118
|
});
|
|
@@ -534,6 +534,7 @@ export * from "./outputref.js";
|
|
|
534
534
|
export * from "./outputspec.js";
|
|
535
535
|
export * from "./outputtext.js";
|
|
536
536
|
export * from "./outputtokensdetails.js";
|
|
537
|
+
export * from "./outputwindow.js";
|
|
537
538
|
export * from "./pagegeneration.js";
|
|
538
539
|
export * from "./pagelogline.js";
|
|
539
540
|
export * from "./param.js";
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
11
|
import {
|
|
@@ -18,6 +19,26 @@ import {
|
|
|
18
19
|
LeakageConfig$Outbound,
|
|
19
20
|
LeakageConfig$outboundSchema,
|
|
20
21
|
} from "./leakageconfig.js";
|
|
22
|
+
import {
|
|
23
|
+
OutputWindow,
|
|
24
|
+
OutputWindow$inboundSchema,
|
|
25
|
+
OutputWindow$Outbound,
|
|
26
|
+
OutputWindow$outboundSchema,
|
|
27
|
+
} from "./outputwindow.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
31
|
+
*/
|
|
32
|
+
export const LeakageGuardrailOutputTiming = {
|
|
33
|
+
Final: "final",
|
|
34
|
+
Streaming: "streaming",
|
|
35
|
+
} as const;
|
|
36
|
+
/**
|
|
37
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
38
|
+
*/
|
|
39
|
+
export type LeakageGuardrailOutputTiming = ClosedEnum<
|
|
40
|
+
typeof LeakageGuardrailOutputTiming
|
|
41
|
+
>;
|
|
21
42
|
|
|
22
43
|
/**
|
|
23
44
|
* Leakage guardrail
|
|
@@ -32,6 +53,14 @@ export type LeakageGuardrail = {
|
|
|
32
53
|
* Also apply this guardrail to model output, not just the request
|
|
33
54
|
*/
|
|
34
55
|
checkOutput?: boolean | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* When this rule checks model output: final (default) checks the finished text once, after it has streamed; streaming holds streamed text in a window and releases only text this rule has cleared
|
|
58
|
+
*/
|
|
59
|
+
outputTiming?: LeakageGuardrailOutputTiming | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* When a streaming output check runs: whichever of max_chars and max_ms fills first
|
|
62
|
+
*/
|
|
63
|
+
outputWindow?: OutputWindow | undefined;
|
|
35
64
|
/**
|
|
36
65
|
* Request sources this guardrail checks before they reach the model. Omit to use the mode's default: every source for classifier; every source except system for ban_words, since instructions often name the terms they forbid; only what the user sends for prompt_injection and leakage, whose keyword patterns match ordinary instructions, replies and documents. An empty list checks no input, so the rule only checks output when check_output is set. Rules saved before this field existed were set to user messages only.
|
|
37
66
|
*/
|
|
@@ -42,6 +71,15 @@ export type LeakageGuardrail = {
|
|
|
42
71
|
config?: LeakageConfig | undefined;
|
|
43
72
|
};
|
|
44
73
|
|
|
74
|
+
/** @internal */
|
|
75
|
+
export const LeakageGuardrailOutputTiming$inboundSchema: z.ZodNativeEnum<
|
|
76
|
+
typeof LeakageGuardrailOutputTiming
|
|
77
|
+
> = z.nativeEnum(LeakageGuardrailOutputTiming);
|
|
78
|
+
/** @internal */
|
|
79
|
+
export const LeakageGuardrailOutputTiming$outboundSchema: z.ZodNativeEnum<
|
|
80
|
+
typeof LeakageGuardrailOutputTiming
|
|
81
|
+
> = LeakageGuardrailOutputTiming$inboundSchema;
|
|
82
|
+
|
|
45
83
|
/** @internal */
|
|
46
84
|
export const LeakageGuardrail$inboundSchema: z.ZodType<
|
|
47
85
|
LeakageGuardrail,
|
|
@@ -51,11 +89,15 @@ export const LeakageGuardrail$inboundSchema: z.ZodType<
|
|
|
51
89
|
mode: z.literal("leakage"),
|
|
52
90
|
enabled: z.boolean().default(true),
|
|
53
91
|
check_output: z.boolean().optional(),
|
|
92
|
+
output_timing: LeakageGuardrailOutputTiming$inboundSchema.optional(),
|
|
93
|
+
output_window: OutputWindow$inboundSchema.optional(),
|
|
54
94
|
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
55
95
|
config: LeakageConfig$inboundSchema.optional(),
|
|
56
96
|
}).transform((v) => {
|
|
57
97
|
return remap$(v, {
|
|
58
98
|
"check_output": "checkOutput",
|
|
99
|
+
"output_timing": "outputTiming",
|
|
100
|
+
"output_window": "outputWindow",
|
|
59
101
|
"input_sources": "inputSources",
|
|
60
102
|
});
|
|
61
103
|
});
|
|
@@ -64,6 +106,8 @@ export type LeakageGuardrail$Outbound = {
|
|
|
64
106
|
mode: "leakage";
|
|
65
107
|
enabled: boolean;
|
|
66
108
|
check_output?: boolean | undefined;
|
|
109
|
+
output_timing?: string | undefined;
|
|
110
|
+
output_window?: OutputWindow$Outbound | undefined;
|
|
67
111
|
input_sources?: Array<string> | undefined;
|
|
68
112
|
config?: LeakageConfig$Outbound | undefined;
|
|
69
113
|
};
|
|
@@ -77,11 +121,15 @@ export const LeakageGuardrail$outboundSchema: z.ZodType<
|
|
|
77
121
|
mode: z.literal("leakage"),
|
|
78
122
|
enabled: z.boolean().default(true),
|
|
79
123
|
checkOutput: z.boolean().optional(),
|
|
124
|
+
outputTiming: LeakageGuardrailOutputTiming$outboundSchema.optional(),
|
|
125
|
+
outputWindow: OutputWindow$outboundSchema.optional(),
|
|
80
126
|
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
81
127
|
config: LeakageConfig$outboundSchema.optional(),
|
|
82
128
|
}).transform((v) => {
|
|
83
129
|
return remap$(v, {
|
|
84
130
|
checkOutput: "check_output",
|
|
131
|
+
outputTiming: "output_timing",
|
|
132
|
+
outputWindow: "output_window",
|
|
85
133
|
inputSources: "input_sources",
|
|
86
134
|
});
|
|
87
135
|
});
|