@meetkai/mka1 0.54.27 → 0.54.29

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.
Files changed (113) hide show
  1. package/bin/mcp-server.js +81 -10
  2. package/bin/mcp-server.js.map +17 -15
  3. package/dist/commonjs/funcs/guardrailsTestGuardrails.d.ts +1 -1
  4. package/dist/commonjs/funcs/guardrailsTestGuardrails.js +1 -1
  5. package/dist/commonjs/funcs/guardrailsUpdateGuardrails.d.ts +1 -1
  6. package/dist/commonjs/funcs/guardrailsUpdateGuardrails.js +1 -1
  7. package/dist/commonjs/lib/config.d.ts +2 -2
  8. package/dist/commonjs/lib/config.js +2 -2
  9. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  10. package/dist/commonjs/mcp-server/server.js +1 -1
  11. package/dist/commonjs/mcp-server/tools/guardrailsTestGuardrails.js +1 -1
  12. package/dist/commonjs/mcp-server/tools/guardrailsTestGuardrails.js.map +1 -1
  13. package/dist/commonjs/mcp-server/tools/guardrailsUpdateGuardrails.js +1 -1
  14. package/dist/commonjs/mcp-server/tools/guardrailsUpdateGuardrails.js.map +1 -1
  15. package/dist/commonjs/models/components/classifierconfig.d.ts +51 -0
  16. package/dist/commonjs/models/components/classifierconfig.d.ts.map +1 -0
  17. package/dist/commonjs/models/components/classifierconfig.js +87 -0
  18. package/dist/commonjs/models/components/classifierconfig.js.map +1 -0
  19. package/dist/commonjs/models/components/classifierguardrail.d.ts +30 -0
  20. package/dist/commonjs/models/components/classifierguardrail.d.ts.map +1 -0
  21. package/dist/commonjs/models/components/classifierguardrail.js +74 -0
  22. package/dist/commonjs/models/components/classifierguardrail.js.map +1 -0
  23. package/dist/commonjs/models/components/getexportstatusresponse.d.ts +1 -0
  24. package/dist/commonjs/models/components/getexportstatusresponse.d.ts.map +1 -1
  25. package/dist/commonjs/models/components/getexportstatusresponse.js +1 -0
  26. package/dist/commonjs/models/components/getexportstatusresponse.js.map +1 -1
  27. package/dist/commonjs/models/components/guardrailconfig.d.ts +3 -2
  28. package/dist/commonjs/models/components/guardrailconfig.d.ts.map +1 -1
  29. package/dist/commonjs/models/components/guardrailconfig.js +3 -0
  30. package/dist/commonjs/models/components/guardrailconfig.js.map +1 -1
  31. package/dist/commonjs/models/components/guardrailmode.d.ts +1 -0
  32. package/dist/commonjs/models/components/guardrailmode.d.ts.map +1 -1
  33. package/dist/commonjs/models/components/guardrailmode.js +1 -0
  34. package/dist/commonjs/models/components/guardrailmode.js.map +1 -1
  35. package/dist/commonjs/models/components/index.d.ts +2 -0
  36. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  37. package/dist/commonjs/models/components/index.js +2 -0
  38. package/dist/commonjs/models/components/index.js.map +1 -1
  39. package/dist/commonjs/models/components/startexportfeedbackresponse.d.ts +1 -0
  40. package/dist/commonjs/models/components/startexportfeedbackresponse.d.ts.map +1 -1
  41. package/dist/commonjs/models/components/startexportfeedbackresponse.js +1 -0
  42. package/dist/commonjs/models/components/startexportfeedbackresponse.js.map +1 -1
  43. package/dist/commonjs/react-query/guardrailsTestGuardrails.d.ts +1 -1
  44. package/dist/commonjs/react-query/guardrailsTestGuardrails.js +1 -1
  45. package/dist/commonjs/react-query/guardrailsUpdateGuardrails.d.ts +1 -1
  46. package/dist/commonjs/react-query/guardrailsUpdateGuardrails.js +1 -1
  47. package/dist/commonjs/sdk/guardrails.d.ts +2 -2
  48. package/dist/commonjs/sdk/guardrails.js +2 -2
  49. package/dist/esm/funcs/guardrailsTestGuardrails.d.ts +1 -1
  50. package/dist/esm/funcs/guardrailsTestGuardrails.js +1 -1
  51. package/dist/esm/funcs/guardrailsUpdateGuardrails.d.ts +1 -1
  52. package/dist/esm/funcs/guardrailsUpdateGuardrails.js +1 -1
  53. package/dist/esm/lib/config.d.ts +2 -2
  54. package/dist/esm/lib/config.js +2 -2
  55. package/dist/esm/mcp-server/mcp-server.js +1 -1
  56. package/dist/esm/mcp-server/server.js +1 -1
  57. package/dist/esm/mcp-server/tools/guardrailsTestGuardrails.js +1 -1
  58. package/dist/esm/mcp-server/tools/guardrailsTestGuardrails.js.map +1 -1
  59. package/dist/esm/mcp-server/tools/guardrailsUpdateGuardrails.js +1 -1
  60. package/dist/esm/mcp-server/tools/guardrailsUpdateGuardrails.js.map +1 -1
  61. package/dist/esm/models/components/classifierconfig.d.ts +51 -0
  62. package/dist/esm/models/components/classifierconfig.d.ts.map +1 -0
  63. package/dist/esm/models/components/classifierconfig.js +49 -0
  64. package/dist/esm/models/components/classifierconfig.js.map +1 -0
  65. package/dist/esm/models/components/classifierguardrail.d.ts +30 -0
  66. package/dist/esm/models/components/classifierguardrail.d.ts.map +1 -0
  67. package/dist/esm/models/components/classifierguardrail.js +36 -0
  68. package/dist/esm/models/components/classifierguardrail.js.map +1 -0
  69. package/dist/esm/models/components/getexportstatusresponse.d.ts +1 -0
  70. package/dist/esm/models/components/getexportstatusresponse.d.ts.map +1 -1
  71. package/dist/esm/models/components/getexportstatusresponse.js +1 -0
  72. package/dist/esm/models/components/getexportstatusresponse.js.map +1 -1
  73. package/dist/esm/models/components/guardrailconfig.d.ts +3 -2
  74. package/dist/esm/models/components/guardrailconfig.d.ts.map +1 -1
  75. package/dist/esm/models/components/guardrailconfig.js +3 -0
  76. package/dist/esm/models/components/guardrailconfig.js.map +1 -1
  77. package/dist/esm/models/components/guardrailmode.d.ts +1 -0
  78. package/dist/esm/models/components/guardrailmode.d.ts.map +1 -1
  79. package/dist/esm/models/components/guardrailmode.js +1 -0
  80. package/dist/esm/models/components/guardrailmode.js.map +1 -1
  81. package/dist/esm/models/components/index.d.ts +2 -0
  82. package/dist/esm/models/components/index.d.ts.map +1 -1
  83. package/dist/esm/models/components/index.js +2 -0
  84. package/dist/esm/models/components/index.js.map +1 -1
  85. package/dist/esm/models/components/startexportfeedbackresponse.d.ts +1 -0
  86. package/dist/esm/models/components/startexportfeedbackresponse.d.ts.map +1 -1
  87. package/dist/esm/models/components/startexportfeedbackresponse.js +1 -0
  88. package/dist/esm/models/components/startexportfeedbackresponse.js.map +1 -1
  89. package/dist/esm/react-query/guardrailsTestGuardrails.d.ts +1 -1
  90. package/dist/esm/react-query/guardrailsTestGuardrails.js +1 -1
  91. package/dist/esm/react-query/guardrailsUpdateGuardrails.d.ts +1 -1
  92. package/dist/esm/react-query/guardrailsUpdateGuardrails.js +1 -1
  93. package/dist/esm/sdk/guardrails.d.ts +2 -2
  94. package/dist/esm/sdk/guardrails.js +2 -2
  95. package/jsr.json +1 -1
  96. package/package.json +1 -1
  97. package/src/funcs/guardrailsTestGuardrails.ts +1 -1
  98. package/src/funcs/guardrailsUpdateGuardrails.ts +1 -1
  99. package/src/lib/config.ts +2 -2
  100. package/src/mcp-server/mcp-server.ts +1 -1
  101. package/src/mcp-server/server.ts +1 -1
  102. package/src/mcp-server/tools/guardrailsTestGuardrails.ts +1 -1
  103. package/src/mcp-server/tools/guardrailsUpdateGuardrails.ts +1 -1
  104. package/src/models/components/classifierconfig.ts +110 -0
  105. package/src/models/components/classifierguardrail.ts +84 -0
  106. package/src/models/components/getexportstatusresponse.ts +1 -0
  107. package/src/models/components/guardrailconfig.ts +11 -1
  108. package/src/models/components/guardrailmode.ts +1 -0
  109. package/src/models/components/index.ts +2 -0
  110. package/src/models/components/startexportfeedbackresponse.ts +1 -0
  111. package/src/react-query/guardrailsTestGuardrails.ts +1 -1
  112. package/src/react-query/guardrailsUpdateGuardrails.ts +1 -1
  113. package/src/sdk/guardrails.ts +2 -2
@@ -0,0 +1,110 @@
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
+ * Stop the request or skip this classifier when evaluation fails
14
+ */
15
+ export const OnError = {
16
+ FailClosed: "fail_closed",
17
+ FailOpen: "fail_open",
18
+ } as const;
19
+ /**
20
+ * Stop the request or skip this classifier when evaluation fails
21
+ */
22
+ export type OnError = ClosedEnum<typeof OnError>;
23
+
24
+ export type ClassifierConfig = {
25
+ /**
26
+ * Exact model ID available in the caller's organization registry
27
+ */
28
+ model: string;
29
+ /**
30
+ * Instructions defining when to block or allow content; content is supplied separately
31
+ */
32
+ prompt: string;
33
+ /**
34
+ * Stop the request or skip this classifier when evaluation fails
35
+ */
36
+ onError?: OnError | undefined;
37
+ /**
38
+ * Message returned when classification blocks content
39
+ */
40
+ rejectionMessage?: string | undefined;
41
+ };
42
+
43
+ /** @internal */
44
+ export const OnError$inboundSchema: z.ZodNativeEnum<typeof OnError> = z
45
+ .nativeEnum(OnError);
46
+ /** @internal */
47
+ export const OnError$outboundSchema: z.ZodNativeEnum<typeof OnError> =
48
+ OnError$inboundSchema;
49
+
50
+ /** @internal */
51
+ export const ClassifierConfig$inboundSchema: z.ZodType<
52
+ ClassifierConfig,
53
+ z.ZodTypeDef,
54
+ unknown
55
+ > = z.object({
56
+ model: z.string(),
57
+ prompt: z.string(),
58
+ on_error: OnError$inboundSchema.default("fail_closed"),
59
+ rejection_message: z.string().default(
60
+ "This request is not allowed by your organization's content policy.",
61
+ ),
62
+ }).transform((v) => {
63
+ return remap$(v, {
64
+ "on_error": "onError",
65
+ "rejection_message": "rejectionMessage",
66
+ });
67
+ });
68
+ /** @internal */
69
+ export type ClassifierConfig$Outbound = {
70
+ model: string;
71
+ prompt: string;
72
+ on_error: string;
73
+ rejection_message: string;
74
+ };
75
+
76
+ /** @internal */
77
+ export const ClassifierConfig$outboundSchema: z.ZodType<
78
+ ClassifierConfig$Outbound,
79
+ z.ZodTypeDef,
80
+ ClassifierConfig
81
+ > = z.object({
82
+ model: z.string(),
83
+ prompt: z.string(),
84
+ onError: OnError$outboundSchema.default("fail_closed"),
85
+ rejectionMessage: z.string().default(
86
+ "This request is not allowed by your organization's content policy.",
87
+ ),
88
+ }).transform((v) => {
89
+ return remap$(v, {
90
+ onError: "on_error",
91
+ rejectionMessage: "rejection_message",
92
+ });
93
+ });
94
+
95
+ export function classifierConfigToJSON(
96
+ classifierConfig: ClassifierConfig,
97
+ ): string {
98
+ return JSON.stringify(
99
+ ClassifierConfig$outboundSchema.parse(classifierConfig),
100
+ );
101
+ }
102
+ export function classifierConfigFromJSON(
103
+ jsonString: string,
104
+ ): SafeParseResult<ClassifierConfig, SDKValidationError> {
105
+ return safeParse(
106
+ jsonString,
107
+ (x) => ClassifierConfig$inboundSchema.parse(JSON.parse(x)),
108
+ `Failed to parse 'ClassifierConfig' from JSON`,
109
+ );
110
+ }
@@ -0,0 +1,84 @@
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
+ import {
11
+ ClassifierConfig,
12
+ ClassifierConfig$inboundSchema,
13
+ ClassifierConfig$Outbound,
14
+ ClassifierConfig$outboundSchema,
15
+ } from "./classifierconfig.js";
16
+
17
+ export type ClassifierGuardrail = {
18
+ mode: "classifier";
19
+ /**
20
+ * Whether this guardrail is enabled
21
+ */
22
+ enabled?: boolean | undefined;
23
+ /**
24
+ * Also apply this guardrail to model output, not just the request
25
+ */
26
+ checkOutput?: boolean | undefined;
27
+ config: ClassifierConfig;
28
+ };
29
+
30
+ /** @internal */
31
+ export const ClassifierGuardrail$inboundSchema: z.ZodType<
32
+ ClassifierGuardrail,
33
+ z.ZodTypeDef,
34
+ unknown
35
+ > = z.object({
36
+ mode: z.literal("classifier"),
37
+ enabled: z.boolean().default(true),
38
+ check_output: z.boolean().optional(),
39
+ config: ClassifierConfig$inboundSchema,
40
+ }).transform((v) => {
41
+ return remap$(v, {
42
+ "check_output": "checkOutput",
43
+ });
44
+ });
45
+ /** @internal */
46
+ export type ClassifierGuardrail$Outbound = {
47
+ mode: "classifier";
48
+ enabled: boolean;
49
+ check_output?: boolean | undefined;
50
+ config: ClassifierConfig$Outbound;
51
+ };
52
+
53
+ /** @internal */
54
+ export const ClassifierGuardrail$outboundSchema: z.ZodType<
55
+ ClassifierGuardrail$Outbound,
56
+ z.ZodTypeDef,
57
+ ClassifierGuardrail
58
+ > = z.object({
59
+ mode: z.literal("classifier"),
60
+ enabled: z.boolean().default(true),
61
+ checkOutput: z.boolean().optional(),
62
+ config: ClassifierConfig$outboundSchema,
63
+ }).transform((v) => {
64
+ return remap$(v, {
65
+ checkOutput: "check_output",
66
+ });
67
+ });
68
+
69
+ export function classifierGuardrailToJSON(
70
+ classifierGuardrail: ClassifierGuardrail,
71
+ ): string {
72
+ return JSON.stringify(
73
+ ClassifierGuardrail$outboundSchema.parse(classifierGuardrail),
74
+ );
75
+ }
76
+ export function classifierGuardrailFromJSON(
77
+ jsonString: string,
78
+ ): SafeParseResult<ClassifierGuardrail, SDKValidationError> {
79
+ return safeParse(
80
+ jsonString,
81
+ (x) => ClassifierGuardrail$inboundSchema.parse(JSON.parse(x)),
82
+ `Failed to parse 'ClassifierGuardrail' from JSON`,
83
+ );
84
+ }
@@ -13,6 +13,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
13
  * Current status of the export job
14
14
  */
15
15
  export const GetExportStatusResponseStatus = {
16
+ Unknown: "UNKNOWN",
16
17
  NotFound: "NOT_FOUND",
17
18
  Running: "RUNNING",
18
19
  Completed: "COMPLETED",
@@ -14,6 +14,12 @@ import {
14
14
  BanWordsGuardrail$Outbound,
15
15
  BanWordsGuardrail$outboundSchema,
16
16
  } from "./banwordsguardrail.js";
17
+ import {
18
+ ClassifierGuardrail,
19
+ ClassifierGuardrail$inboundSchema,
20
+ ClassifierGuardrail$Outbound,
21
+ ClassifierGuardrail$outboundSchema,
22
+ } from "./classifierguardrail.js";
17
23
  import {
18
24
  LeakageGuardrail,
19
25
  LeakageGuardrail$inboundSchema,
@@ -31,6 +37,7 @@ export type GuardrailConfig =
31
37
  | BanWordsGuardrail
32
38
  | PromptInjectionGuardrail
33
39
  | LeakageGuardrail
40
+ | ClassifierGuardrail
34
41
  | discriminatedUnionTypes.Unknown<"mode">;
35
42
 
36
43
  /** @internal */
@@ -42,12 +49,14 @@ export const GuardrailConfig$inboundSchema: z.ZodType<
42
49
  ban_words: BanWordsGuardrail$inboundSchema,
43
50
  prompt_injection: PromptInjectionGuardrail$inboundSchema,
44
51
  leakage: LeakageGuardrail$inboundSchema,
52
+ classifier: ClassifierGuardrail$inboundSchema,
45
53
  });
46
54
  /** @internal */
47
55
  export type GuardrailConfig$Outbound =
48
56
  | BanWordsGuardrail$Outbound
49
57
  | PromptInjectionGuardrail$Outbound
50
- | LeakageGuardrail$Outbound;
58
+ | LeakageGuardrail$Outbound
59
+ | ClassifierGuardrail$Outbound;
51
60
 
52
61
  /** @internal */
53
62
  export const GuardrailConfig$outboundSchema: z.ZodType<
@@ -58,6 +67,7 @@ export const GuardrailConfig$outboundSchema: z.ZodType<
58
67
  BanWordsGuardrail$outboundSchema,
59
68
  PromptInjectionGuardrail$outboundSchema,
60
69
  LeakageGuardrail$outboundSchema,
70
+ ClassifierGuardrail$outboundSchema,
61
71
  ]);
62
72
 
63
73
  export function guardrailConfigToJSON(
@@ -9,6 +9,7 @@ export const GuardrailMode = {
9
9
  BanWords: "ban_words",
10
10
  PromptInjection: "prompt_injection",
11
11
  Leakage: "leakage",
12
+ Classifier: "classifier",
12
13
  } as const;
13
14
  export type GuardrailMode = ClosedEnum<typeof GuardrailMode>;
14
15
 
@@ -53,6 +53,8 @@ export * from "./checkpointmetrics.js";
53
53
  export * from "./chunkingstrategy.js";
54
54
  export * from "./classificationrequest.js";
55
55
  export * from "./classificationresponse.js";
56
+ export * from "./classifierconfig.js";
57
+ export * from "./classifierguardrail.js";
56
58
  export * from "./classifygroupby.js";
57
59
  export * from "./clickaction.js";
58
60
  export * from "./clustercurrencyresponse.js";
@@ -13,6 +13,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
13
  * Current status of the export job
14
14
  */
15
15
  export const StartExportFeedbackResponseStatus = {
16
+ Unknown: "UNKNOWN",
16
17
  NotFound: "NOT_FOUND",
17
18
  Running: "RUNNING",
18
19
  Completed: "COMPLETED",
@@ -49,7 +49,7 @@ export type GuardrailsTestGuardrailsMutationError =
49
49
  * Test content against guardrails
50
50
  *
51
51
  * @remarks
52
- * Test a piece of content against the caller's effective guardrails (org-wide policy plus team policy) without making an actual API call. Useful for debugging and validating guardrail configurations. Returns a report indicating whether the content passed and which guardrail was triggered if any.
52
+ * Test a piece of content against the caller's effective guardrails (org-wide policy plus team policy) without generating an answer. Classifier guardrails call their configured model and incur inference usage; API keys additionally require write:responses and must pass the spend budget gate. Useful for debugging and validating guardrail configurations. Returns a report indicating whether the content passed and which guardrail was triggered if any.
53
53
  */
54
54
  export function useGuardrailsTestGuardrailsMutation(
55
55
  options?: MutationHookOptions<
@@ -49,7 +49,7 @@ export type GuardrailsUpdateGuardrailsMutationError =
49
49
  * Update guardrails policy
50
50
  *
51
51
  * @remarks
52
- * Replace a guardrails policy. Omit team_id to set the org-wide policy (org admin only); provide team_id to set that team's additional policy (org admins may target any team in their org, other callers only their own team). The org-wide policy applies to every team; a team policy is enforced in addition to it — configuring a team policy never weakens the org-wide one.
52
+ * Replace a guardrails policy. Classifier models must be active and declare structured-output support; replace the example model ID with a suitable model from your organization. Omit team_id to set the org-wide policy (org admin only); provide team_id to set that team's additional policy (org admins may target any team in their org, other callers only their own team). The org-wide policy applies to every team; a team policy is enforced in addition to it — configuring a team policy never weakens the org-wide one.
53
53
  */
54
54
  export function useGuardrailsUpdateGuardrailsMutation(
55
55
  options?: MutationHookOptions<
@@ -34,7 +34,7 @@ export class Guardrails extends ClientSDK {
34
34
  * Update guardrails policy
35
35
  *
36
36
  * @remarks
37
- * Replace a guardrails policy. Omit team_id to set the org-wide policy (org admin only); provide team_id to set that team's additional policy (org admins may target any team in their org, other callers only their own team). The org-wide policy applies to every team; a team policy is enforced in addition to it — configuring a team policy never weakens the org-wide one.
37
+ * Replace a guardrails policy. Classifier models must be active and declare structured-output support; replace the example model ID with a suitable model from your organization. Omit team_id to set the org-wide policy (org admin only); provide team_id to set that team's additional policy (org admins may target any team in their org, other callers only their own team). The org-wide policy applies to every team; a team policy is enforced in addition to it — configuring a team policy never weakens the org-wide one.
38
38
  */
39
39
  async updateGuardrails(
40
40
  request: operations.UpdateGuardrailsRequest,
@@ -85,7 +85,7 @@ export class Guardrails extends ClientSDK {
85
85
  * Test content against guardrails
86
86
  *
87
87
  * @remarks
88
- * Test a piece of content against the caller's effective guardrails (org-wide policy plus team policy) without making an actual API call. Useful for debugging and validating guardrail configurations. Returns a report indicating whether the content passed and which guardrail was triggered if any.
88
+ * Test a piece of content against the caller's effective guardrails (org-wide policy plus team policy) without generating an answer. Classifier guardrails call their configured model and incur inference usage; API keys additionally require write:responses and must pass the spend budget gate. Useful for debugging and validating guardrail configurations. Returns a report indicating whether the content passed and which guardrail was triggered if any.
89
89
  */
90
90
  async testGuardrails(
91
91
  request: operations.TestGuardrailsRequest,