@meetkai/mka1 0.55.4 → 0.55.6
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/README.md +360 -360
- package/bin/mcp-server.js +1571 -1156
- package/bin/mcp-server.js.map +23 -16
- package/dist/commonjs/funcs/llmModelsGetOrgTokenQuota.d.ts +19 -0
- package/dist/commonjs/funcs/llmModelsGetOrgTokenQuota.d.ts.map +1 -0
- package/dist/commonjs/funcs/llmModelsGetOrgTokenQuota.js +132 -0
- package/dist/commonjs/funcs/llmModelsGetOrgTokenQuota.js.map +1 -0
- package/dist/commonjs/funcs/llmModelsSetOrgTokenQuota.d.ts +19 -0
- package/dist/commonjs/funcs/llmModelsSetOrgTokenQuota.d.ts.map +1 -0
- package/dist/commonjs/funcs/llmModelsSetOrgTokenQuota.js +133 -0
- package/dist/commonjs/funcs/llmModelsSetOrgTokenQuota.js.map +1 -0
- 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.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +5 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/llmModelsGetOrgTokenQuota.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/llmModelsGetOrgTokenQuota.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/llmModelsGetOrgTokenQuota.js +64 -0
- package/dist/commonjs/mcp-server/tools/llmModelsGetOrgTokenQuota.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/llmModelsSetOrgTokenQuota.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/llmModelsSetOrgTokenQuota.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/llmModelsSetOrgTokenQuota.js +64 -0
- package/dist/commonjs/mcp-server/tools/llmModelsSetOrgTokenQuota.js.map +1 -0
- package/dist/commonjs/models/components/banwordsguardrail.d.ts +6 -0
- package/dist/commonjs/models/components/banwordsguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/banwordsguardrail.js +5 -0
- package/dist/commonjs/models/components/banwordsguardrail.js.map +1 -1
- package/dist/commonjs/models/components/classifierguardrail.d.ts +6 -0
- package/dist/commonjs/models/components/classifierguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/classifierguardrail.js +5 -0
- package/dist/commonjs/models/components/classifierguardrail.js.map +1 -1
- package/dist/commonjs/models/components/clusterdefaultrulesummary.d.ts +6 -0
- package/dist/commonjs/models/components/clusterdefaultrulesummary.d.ts.map +1 -1
- package/dist/commonjs/models/components/clusterdefaultrulesummary.js +5 -0
- package/dist/commonjs/models/components/clusterdefaultrulesummary.js.map +1 -1
- package/dist/commonjs/models/components/guardrailinputsource.d.ts +23 -0
- package/dist/commonjs/models/components/guardrailinputsource.d.ts.map +1 -0
- package/dist/commonjs/models/components/guardrailinputsource.js +57 -0
- package/dist/commonjs/models/components/guardrailinputsource.js.map +1 -0
- 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 +6 -0
- package/dist/commonjs/models/components/leakageguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/leakageguardrail.js +5 -0
- package/dist/commonjs/models/components/leakageguardrail.js.map +1 -1
- package/dist/commonjs/models/components/promptinjectionguardrail.d.ts +6 -0
- package/dist/commonjs/models/components/promptinjectionguardrail.d.ts.map +1 -1
- package/dist/commonjs/models/components/promptinjectionguardrail.js +5 -0
- package/dist/commonjs/models/components/promptinjectionguardrail.js.map +1 -1
- package/dist/commonjs/models/components/testguardrailsrequest.d.ts +6 -0
- package/dist/commonjs/models/components/testguardrailsrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/testguardrailsrequest.js +3 -0
- package/dist/commonjs/models/components/testguardrailsrequest.js.map +1 -1
- package/dist/commonjs/models/operations/createchatcompletionstream.d.ts +14 -14
- package/dist/commonjs/models/operations/createchatcompletionstream.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createchatcompletionstream.js +21 -25
- package/dist/commonjs/models/operations/createchatcompletionstream.js.map +1 -1
- package/dist/commonjs/models/operations/getorgtokenquota.d.ts +50 -0
- package/dist/commonjs/models/operations/getorgtokenquota.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getorgtokenquota.js +106 -0
- package/dist/commonjs/models/operations/getorgtokenquota.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listbudgets.d.ts +10 -10
- package/dist/commonjs/models/operations/listbudgets.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listbudgets.js +12 -12
- package/dist/commonjs/models/operations/listbudgets.js.map +1 -1
- package/dist/commonjs/models/operations/setorgtokenquota.d.ts +101 -0
- package/dist/commonjs/models/operations/setorgtokenquota.d.ts.map +1 -0
- package/dist/commonjs/models/operations/setorgtokenquota.js +180 -0
- package/dist/commonjs/models/operations/setorgtokenquota.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.core.d.ts +12 -0
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.core.js +34 -0
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.core.js.map +1 -0
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.d.ts +28 -0
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.d.ts.map +1 -0
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.js +60 -0
- package/dist/commonjs/react-query/llmModelsGetOrgTokenQuota.js.map +1 -0
- package/dist/commonjs/react-query/llmModelsSetOrgTokenQuota.d.ts +28 -0
- package/dist/commonjs/react-query/llmModelsSetOrgTokenQuota.d.ts.map +1 -0
- package/dist/commonjs/react-query/llmModelsSetOrgTokenQuota.js +47 -0
- package/dist/commonjs/react-query/llmModelsSetOrgTokenQuota.js.map +1 -0
- package/dist/commonjs/sdk/models.d.ts +14 -0
- package/dist/commonjs/sdk/models.d.ts.map +1 -1
- package/dist/commonjs/sdk/models.js +20 -0
- package/dist/commonjs/sdk/models.js.map +1 -1
- package/dist/esm/funcs/llmModelsGetOrgTokenQuota.d.ts +19 -0
- package/dist/esm/funcs/llmModelsGetOrgTokenQuota.d.ts.map +1 -0
- package/dist/esm/funcs/llmModelsGetOrgTokenQuota.js +96 -0
- package/dist/esm/funcs/llmModelsGetOrgTokenQuota.js.map +1 -0
- package/dist/esm/funcs/llmModelsSetOrgTokenQuota.d.ts +19 -0
- package/dist/esm/funcs/llmModelsSetOrgTokenQuota.d.ts.map +1 -0
- package/dist/esm/funcs/llmModelsSetOrgTokenQuota.js +97 -0
- package/dist/esm/funcs/llmModelsSetOrgTokenQuota.js.map +1 -0
- 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.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +5 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/llmModelsGetOrgTokenQuota.d.ts +8 -0
- package/dist/esm/mcp-server/tools/llmModelsGetOrgTokenQuota.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/llmModelsGetOrgTokenQuota.js +28 -0
- package/dist/esm/mcp-server/tools/llmModelsGetOrgTokenQuota.js.map +1 -0
- package/dist/esm/mcp-server/tools/llmModelsSetOrgTokenQuota.d.ts +8 -0
- package/dist/esm/mcp-server/tools/llmModelsSetOrgTokenQuota.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/llmModelsSetOrgTokenQuota.js +28 -0
- package/dist/esm/mcp-server/tools/llmModelsSetOrgTokenQuota.js.map +1 -0
- package/dist/esm/models/components/banwordsguardrail.d.ts +6 -0
- package/dist/esm/models/components/banwordsguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/banwordsguardrail.js +5 -0
- package/dist/esm/models/components/banwordsguardrail.js.map +1 -1
- package/dist/esm/models/components/classifierguardrail.d.ts +6 -0
- package/dist/esm/models/components/classifierguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/classifierguardrail.js +5 -0
- package/dist/esm/models/components/classifierguardrail.js.map +1 -1
- package/dist/esm/models/components/clusterdefaultrulesummary.d.ts +6 -0
- package/dist/esm/models/components/clusterdefaultrulesummary.d.ts.map +1 -1
- package/dist/esm/models/components/clusterdefaultrulesummary.js +5 -0
- package/dist/esm/models/components/clusterdefaultrulesummary.js.map +1 -1
- package/dist/esm/models/components/guardrailinputsource.d.ts +23 -0
- package/dist/esm/models/components/guardrailinputsource.d.ts.map +1 -0
- package/dist/esm/models/components/guardrailinputsource.js +21 -0
- package/dist/esm/models/components/guardrailinputsource.js.map +1 -0
- 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 +6 -0
- package/dist/esm/models/components/leakageguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/leakageguardrail.js +5 -0
- package/dist/esm/models/components/leakageguardrail.js.map +1 -1
- package/dist/esm/models/components/promptinjectionguardrail.d.ts +6 -0
- package/dist/esm/models/components/promptinjectionguardrail.d.ts.map +1 -1
- package/dist/esm/models/components/promptinjectionguardrail.js +5 -0
- package/dist/esm/models/components/promptinjectionguardrail.js.map +1 -1
- package/dist/esm/models/components/testguardrailsrequest.d.ts +6 -0
- package/dist/esm/models/components/testguardrailsrequest.d.ts.map +1 -1
- package/dist/esm/models/components/testguardrailsrequest.js +3 -0
- package/dist/esm/models/components/testguardrailsrequest.js.map +1 -1
- package/dist/esm/models/operations/createchatcompletionstream.d.ts +14 -14
- package/dist/esm/models/operations/createchatcompletionstream.d.ts.map +1 -1
- package/dist/esm/models/operations/createchatcompletionstream.js +16 -20
- package/dist/esm/models/operations/createchatcompletionstream.js.map +1 -1
- package/dist/esm/models/operations/getorgtokenquota.d.ts +50 -0
- package/dist/esm/models/operations/getorgtokenquota.d.ts.map +1 -0
- package/dist/esm/models/operations/getorgtokenquota.js +66 -0
- package/dist/esm/models/operations/getorgtokenquota.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listbudgets.d.ts +10 -10
- package/dist/esm/models/operations/listbudgets.d.ts.map +1 -1
- package/dist/esm/models/operations/listbudgets.js +11 -11
- package/dist/esm/models/operations/listbudgets.js.map +1 -1
- package/dist/esm/models/operations/setorgtokenquota.d.ts +101 -0
- package/dist/esm/models/operations/setorgtokenquota.d.ts.map +1 -0
- package/dist/esm/models/operations/setorgtokenquota.js +134 -0
- package/dist/esm/models/operations/setorgtokenquota.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.core.d.ts +12 -0
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.core.d.ts.map +1 -0
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.core.js +29 -0
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.core.js.map +1 -0
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.d.ts +28 -0
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.d.ts.map +1 -0
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.js +50 -0
- package/dist/esm/react-query/llmModelsGetOrgTokenQuota.js.map +1 -0
- package/dist/esm/react-query/llmModelsSetOrgTokenQuota.d.ts +28 -0
- package/dist/esm/react-query/llmModelsSetOrgTokenQuota.d.ts.map +1 -0
- package/dist/esm/react-query/llmModelsSetOrgTokenQuota.js +42 -0
- package/dist/esm/react-query/llmModelsSetOrgTokenQuota.js.map +1 -0
- package/dist/esm/sdk/models.d.ts +14 -0
- package/dist/esm/sdk/models.d.ts.map +1 -1
- package/dist/esm/sdk/models.js +20 -0
- package/dist/esm/sdk/models.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/llmModelsGetOrgTokenQuota.ts +181 -0
- package/src/funcs/llmModelsSetOrgTokenQuota.ts +182 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/llmModelsGetOrgTokenQuota.ts +37 -0
- package/src/mcp-server/tools/llmModelsSetOrgTokenQuota.ts +37 -0
- package/src/models/components/banwordsguardrail.ts +14 -0
- package/src/models/components/classifierguardrail.ts +14 -0
- package/src/models/components/clusterdefaultrulesummary.ts +14 -0
- package/src/models/components/guardrailinputsource.ts +32 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/components/leakageguardrail.ts +14 -0
- package/src/models/components/promptinjectionguardrail.ts +14 -0
- package/src/models/components/testguardrailsrequest.ts +12 -0
- package/src/models/operations/createchatcompletionstream.ts +72 -60
- package/src/models/operations/getorgtokenquota.ts +145 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/listbudgets.ts +20 -20
- package/src/models/operations/setorgtokenquota.ts +287 -0
- package/src/react-query/index.ts +2 -0
- package/src/react-query/llmModelsGetOrgTokenQuota.core.ts +71 -0
- package/src/react-query/llmModelsGetOrgTokenQuota.ts +136 -0
- package/src/react-query/llmModelsSetOrgTokenQuota.ts +109 -0
- package/src/sdk/models.ts +36 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Set an organization's token quota
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Cluster admins may create or replace the minute/day/month token allowance, or disable it with enabled: false. Changes apply to new admissions within 10 seconds; admitted requests finish. Limit changes preserve usage. Period changes use that period's calendar bucket; usage while disabled is not counted. The cluster organization cannot be capped.
|
|
33
|
+
*
|
|
34
|
+
* If set, this operation will use {@link Security.bearerAuth} from the global security.
|
|
35
|
+
*/
|
|
36
|
+
export function llmModelsSetOrgTokenQuota(
|
|
37
|
+
client: SDKCore,
|
|
38
|
+
request: operations.SetOrgTokenQuotaRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.SetOrgTokenQuotaResponseBody,
|
|
43
|
+
| SDKError
|
|
44
|
+
| ResponseValidationError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| InvalidRequestError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| SDKValidationError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
return new APIPromise($do(
|
|
54
|
+
client,
|
|
55
|
+
request,
|
|
56
|
+
options,
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function $do(
|
|
61
|
+
client: SDKCore,
|
|
62
|
+
request: operations.SetOrgTokenQuotaRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
operations.SetOrgTokenQuotaResponseBody,
|
|
68
|
+
| SDKError
|
|
69
|
+
| ResponseValidationError
|
|
70
|
+
| ConnectionError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| InvalidRequestError
|
|
74
|
+
| UnexpectedClientError
|
|
75
|
+
| SDKValidationError
|
|
76
|
+
>,
|
|
77
|
+
APICall,
|
|
78
|
+
]
|
|
79
|
+
> {
|
|
80
|
+
const parsed = safeParse(
|
|
81
|
+
request,
|
|
82
|
+
(value) => operations.SetOrgTokenQuotaRequest$outboundSchema.parse(value),
|
|
83
|
+
"Input validation failed",
|
|
84
|
+
);
|
|
85
|
+
if (!parsed.ok) {
|
|
86
|
+
return [parsed, { status: "invalid" }];
|
|
87
|
+
}
|
|
88
|
+
const payload = parsed.value;
|
|
89
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
90
|
+
|
|
91
|
+
const pathParams = {
|
|
92
|
+
org_id: encodeSimple("org_id", payload.org_id, {
|
|
93
|
+
explode: false,
|
|
94
|
+
charEncoding: "percent",
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
97
|
+
const path = pathToFunc("/api/v1/llm/models/orgs/{org_id}/token-quota")(
|
|
98
|
+
pathParams,
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const headers = new Headers(compactMap({
|
|
102
|
+
"Content-Type": "application/json",
|
|
103
|
+
Accept: "application/json",
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
107
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
108
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
109
|
+
|
|
110
|
+
const context = {
|
|
111
|
+
options: client._options,
|
|
112
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
113
|
+
operationID: "setOrgTokenQuota",
|
|
114
|
+
oAuth2Scopes: null,
|
|
115
|
+
|
|
116
|
+
resolvedSecurity: requestSecurity,
|
|
117
|
+
|
|
118
|
+
securitySource: client._options.bearerAuth,
|
|
119
|
+
retryConfig: options?.retries
|
|
120
|
+
|| client._options.retryConfig
|
|
121
|
+
|| {
|
|
122
|
+
strategy: "backoff",
|
|
123
|
+
backoff: {
|
|
124
|
+
initialInterval: 500,
|
|
125
|
+
maxInterval: 5000,
|
|
126
|
+
exponent: 1.5,
|
|
127
|
+
maxElapsedTime: 15000,
|
|
128
|
+
},
|
|
129
|
+
retryConnectionErrors: true,
|
|
130
|
+
}
|
|
131
|
+
|| { strategy: "none" },
|
|
132
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const requestRes = client._createRequest(context, {
|
|
136
|
+
security: requestSecurity,
|
|
137
|
+
method: "PUT",
|
|
138
|
+
baseURL: options?.serverURL,
|
|
139
|
+
path: path,
|
|
140
|
+
headers: headers,
|
|
141
|
+
body: body,
|
|
142
|
+
userAgent: client._options.userAgent,
|
|
143
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
144
|
+
}, options);
|
|
145
|
+
if (!requestRes.ok) {
|
|
146
|
+
return [requestRes, { status: "invalid" }];
|
|
147
|
+
}
|
|
148
|
+
const req = requestRes.value;
|
|
149
|
+
|
|
150
|
+
const doResult = await client._do(req, {
|
|
151
|
+
context,
|
|
152
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
153
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
154
|
+
retryConfig: context.retryConfig,
|
|
155
|
+
retryCodes: context.retryCodes,
|
|
156
|
+
});
|
|
157
|
+
if (!doResult.ok) {
|
|
158
|
+
return [doResult, { status: "request-error", request: req }];
|
|
159
|
+
}
|
|
160
|
+
const response = doResult.value;
|
|
161
|
+
|
|
162
|
+
const [result] = await M.match<
|
|
163
|
+
operations.SetOrgTokenQuotaResponseBody,
|
|
164
|
+
| SDKError
|
|
165
|
+
| ResponseValidationError
|
|
166
|
+
| ConnectionError
|
|
167
|
+
| RequestAbortedError
|
|
168
|
+
| RequestTimeoutError
|
|
169
|
+
| InvalidRequestError
|
|
170
|
+
| UnexpectedClientError
|
|
171
|
+
| SDKValidationError
|
|
172
|
+
>(
|
|
173
|
+
M.json(200, operations.SetOrgTokenQuotaResponseBody$inboundSchema),
|
|
174
|
+
M.fail("4XX"),
|
|
175
|
+
M.fail("5XX"),
|
|
176
|
+
)(response, req);
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
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.6",
|
|
69
69
|
genVersion: "2.950.2",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.55.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.55.6 2.950.2 1.1.0 @meetkai/mka1",
|
|
71
71
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -333,6 +333,7 @@ import { tool$llmModelsDeleteCatalogEntry } from "./tools/llmModelsDeleteCatalog
|
|
|
333
333
|
import { tool$llmModelsDeleteOrgAutoModel } from "./tools/llmModelsDeleteOrgAutoModel.js";
|
|
334
334
|
import { tool$llmModelsGet } from "./tools/llmModelsGet.js";
|
|
335
335
|
import { tool$llmModelsGetClusterCurrency } from "./tools/llmModelsGetClusterCurrency.js";
|
|
336
|
+
import { tool$llmModelsGetOrgTokenQuota } from "./tools/llmModelsGetOrgTokenQuota.js";
|
|
336
337
|
import { tool$llmModelsGetQuota } from "./tools/llmModelsGetQuota.js";
|
|
337
338
|
import { tool$llmModelsList } from "./tools/llmModelsList.js";
|
|
338
339
|
import { tool$llmModelsListCatalog } from "./tools/llmModelsListCatalog.js";
|
|
@@ -348,6 +349,7 @@ import { tool$llmModelsReplaceCatalogOrgAccess } from "./tools/llmModelsReplaceC
|
|
|
348
349
|
import { tool$llmModelsSetClusterCurrency } from "./tools/llmModelsSetClusterCurrency.js";
|
|
349
350
|
import { tool$llmModelsSetClusterPrice } from "./tools/llmModelsSetClusterPrice.js";
|
|
350
351
|
import { tool$llmModelsSetOrgPrice } from "./tools/llmModelsSetOrgPrice.js";
|
|
352
|
+
import { tool$llmModelsSetOrgTokenQuota } from "./tools/llmModelsSetOrgTokenQuota.js";
|
|
351
353
|
import { tool$llmModelsUpdateCatalogEntry } from "./tools/llmModelsUpdateCatalogEntry.js";
|
|
352
354
|
import { tool$llmPromptsCreate } from "./tools/llmPromptsCreate.js";
|
|
353
355
|
import { tool$llmPromptsCreateVersion } from "./tools/llmPromptsCreateVersion.js";
|
|
@@ -507,7 +509,7 @@ export function createMCPServer(deps: {
|
|
|
507
509
|
}) {
|
|
508
510
|
const server = new McpServer({
|
|
509
511
|
name: "SDK",
|
|
510
|
-
version: "0.55.
|
|
512
|
+
version: "0.55.6",
|
|
511
513
|
});
|
|
512
514
|
|
|
513
515
|
const client = new SDKCore({
|
|
@@ -808,6 +810,8 @@ export function createMCPServer(deps: {
|
|
|
808
810
|
tool(tool$llmModelsList);
|
|
809
811
|
tool(tool$llmModelsGet);
|
|
810
812
|
tool(tool$llmModelsGetQuota);
|
|
813
|
+
tool(tool$llmModelsGetOrgTokenQuota);
|
|
814
|
+
tool(tool$llmModelsSetOrgTokenQuota);
|
|
811
815
|
tool(tool$llmModelsListCatalog);
|
|
812
816
|
tool(tool$llmModelsAddCatalogEntry);
|
|
813
817
|
tool(tool$llmModelsUpdateCatalogEntry);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { llmModelsGetOrgTokenQuota } from "../../funcs/llmModelsGetOrgTokenQuota.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.GetOrgTokenQuotaRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$llmModelsGetOrgTokenQuota: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "llm-models-get-org-token-quota",
|
|
15
|
+
description: `Get an organization's token quota
|
|
16
|
+
|
|
17
|
+
Cluster-admin read of the aggregate token policy across all models. An absent or disabled quota returns enabled: false with null limit and period. Does not require a model or change the active organization.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await llmModelsGetOrgTokenQuota(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.mcpReq.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { llmModelsSetOrgTokenQuota } from "../../funcs/llmModelsSetOrgTokenQuota.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.SetOrgTokenQuotaRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$llmModelsSetOrgTokenQuota: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "llm-models-set-org-token-quota",
|
|
15
|
+
description: `Set an organization's token quota
|
|
16
|
+
|
|
17
|
+
Cluster admins may create or replace the minute/day/month token allowance, or disable it with enabled: false. Changes apply to new admissions within 10 seconds; admitted requests finish. Limit changes preserve usage. Period changes use that period's calendar bucket; usage while disabled is not counted. The cluster organization cannot be capped.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await llmModelsSetOrgTokenQuota(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.mcpReq.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -13,6 +13,11 @@ import {
|
|
|
13
13
|
BanWordsConfig$Outbound,
|
|
14
14
|
BanWordsConfig$outboundSchema,
|
|
15
15
|
} from "./banwordsconfig.js";
|
|
16
|
+
import {
|
|
17
|
+
GuardrailInputSource,
|
|
18
|
+
GuardrailInputSource$inboundSchema,
|
|
19
|
+
GuardrailInputSource$outboundSchema,
|
|
20
|
+
} from "./guardrailinputsource.js";
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Banned words guardrail
|
|
@@ -27,6 +32,10 @@ export type BanWordsGuardrail = {
|
|
|
27
32
|
* Also apply this guardrail to model output, not just the request
|
|
28
33
|
*/
|
|
29
34
|
checkOutput?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* 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
|
+
*/
|
|
38
|
+
inputSources?: Array<GuardrailInputSource> | undefined;
|
|
30
39
|
/**
|
|
31
40
|
* Configuration for banned words guardrail
|
|
32
41
|
*/
|
|
@@ -42,10 +51,12 @@ export const BanWordsGuardrail$inboundSchema: z.ZodType<
|
|
|
42
51
|
mode: z.literal("ban_words"),
|
|
43
52
|
enabled: z.boolean().default(true),
|
|
44
53
|
check_output: z.boolean().optional(),
|
|
54
|
+
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
45
55
|
config: BanWordsConfig$inboundSchema.optional(),
|
|
46
56
|
}).transform((v) => {
|
|
47
57
|
return remap$(v, {
|
|
48
58
|
"check_output": "checkOutput",
|
|
59
|
+
"input_sources": "inputSources",
|
|
49
60
|
});
|
|
50
61
|
});
|
|
51
62
|
/** @internal */
|
|
@@ -53,6 +64,7 @@ export type BanWordsGuardrail$Outbound = {
|
|
|
53
64
|
mode: "ban_words";
|
|
54
65
|
enabled: boolean;
|
|
55
66
|
check_output?: boolean | undefined;
|
|
67
|
+
input_sources?: Array<string> | undefined;
|
|
56
68
|
config?: BanWordsConfig$Outbound | undefined;
|
|
57
69
|
};
|
|
58
70
|
|
|
@@ -65,10 +77,12 @@ export const BanWordsGuardrail$outboundSchema: z.ZodType<
|
|
|
65
77
|
mode: z.literal("ban_words"),
|
|
66
78
|
enabled: z.boolean().default(true),
|
|
67
79
|
checkOutput: z.boolean().optional(),
|
|
80
|
+
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
68
81
|
config: BanWordsConfig$outboundSchema.optional(),
|
|
69
82
|
}).transform((v) => {
|
|
70
83
|
return remap$(v, {
|
|
71
84
|
checkOutput: "check_output",
|
|
85
|
+
inputSources: "input_sources",
|
|
72
86
|
});
|
|
73
87
|
});
|
|
74
88
|
|
|
@@ -13,6 +13,11 @@ import {
|
|
|
13
13
|
ClassifierConfig$Outbound,
|
|
14
14
|
ClassifierConfig$outboundSchema,
|
|
15
15
|
} from "./classifierconfig.js";
|
|
16
|
+
import {
|
|
17
|
+
GuardrailInputSource,
|
|
18
|
+
GuardrailInputSource$inboundSchema,
|
|
19
|
+
GuardrailInputSource$outboundSchema,
|
|
20
|
+
} from "./guardrailinputsource.js";
|
|
16
21
|
|
|
17
22
|
export type ClassifierGuardrail = {
|
|
18
23
|
mode: "classifier";
|
|
@@ -24,6 +29,10 @@ export type ClassifierGuardrail = {
|
|
|
24
29
|
* Also apply this guardrail to model output, not just the request
|
|
25
30
|
*/
|
|
26
31
|
checkOutput?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* 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
|
+
*/
|
|
35
|
+
inputSources?: Array<GuardrailInputSource> | undefined;
|
|
27
36
|
config: ClassifierConfig;
|
|
28
37
|
};
|
|
29
38
|
|
|
@@ -36,10 +45,12 @@ export const ClassifierGuardrail$inboundSchema: z.ZodType<
|
|
|
36
45
|
mode: z.literal("classifier"),
|
|
37
46
|
enabled: z.boolean().default(true),
|
|
38
47
|
check_output: z.boolean().optional(),
|
|
48
|
+
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
39
49
|
config: ClassifierConfig$inboundSchema,
|
|
40
50
|
}).transform((v) => {
|
|
41
51
|
return remap$(v, {
|
|
42
52
|
"check_output": "checkOutput",
|
|
53
|
+
"input_sources": "inputSources",
|
|
43
54
|
});
|
|
44
55
|
});
|
|
45
56
|
/** @internal */
|
|
@@ -47,6 +58,7 @@ export type ClassifierGuardrail$Outbound = {
|
|
|
47
58
|
mode: "classifier";
|
|
48
59
|
enabled: boolean;
|
|
49
60
|
check_output?: boolean | undefined;
|
|
61
|
+
input_sources?: Array<string> | undefined;
|
|
50
62
|
config: ClassifierConfig$Outbound;
|
|
51
63
|
};
|
|
52
64
|
|
|
@@ -59,10 +71,12 @@ export const ClassifierGuardrail$outboundSchema: z.ZodType<
|
|
|
59
71
|
mode: z.literal("classifier"),
|
|
60
72
|
enabled: z.boolean().default(true),
|
|
61
73
|
checkOutput: z.boolean().optional(),
|
|
74
|
+
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
62
75
|
config: ClassifierConfig$outboundSchema,
|
|
63
76
|
}).transform((v) => {
|
|
64
77
|
return remap$(v, {
|
|
65
78
|
checkOutput: "check_output",
|
|
79
|
+
inputSources: "input_sources",
|
|
66
80
|
});
|
|
67
81
|
});
|
|
68
82
|
|
|
@@ -7,6 +7,11 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
GuardrailInputSource,
|
|
12
|
+
GuardrailInputSource$inboundSchema,
|
|
13
|
+
GuardrailInputSource$outboundSchema,
|
|
14
|
+
} from "./guardrailinputsource.js";
|
|
10
15
|
import {
|
|
11
16
|
GuardrailMode,
|
|
12
17
|
GuardrailMode$inboundSchema,
|
|
@@ -23,6 +28,10 @@ export type ClusterDefaultRuleSummary = {
|
|
|
23
28
|
* Whether this guardrail also checks model output
|
|
24
29
|
*/
|
|
25
30
|
checkOutput?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Request sources this guardrail checks
|
|
33
|
+
*/
|
|
34
|
+
inputSources: Array<GuardrailInputSource>;
|
|
26
35
|
/**
|
|
27
36
|
* The message returned when this guardrail blocks a request
|
|
28
37
|
*/
|
|
@@ -38,10 +47,12 @@ export const ClusterDefaultRuleSummary$inboundSchema: z.ZodType<
|
|
|
38
47
|
mode: GuardrailMode$inboundSchema,
|
|
39
48
|
enabled: z.boolean(),
|
|
40
49
|
check_output: z.boolean().optional(),
|
|
50
|
+
input_sources: z.array(GuardrailInputSource$inboundSchema),
|
|
41
51
|
rejection_message: z.string().optional(),
|
|
42
52
|
}).transform((v) => {
|
|
43
53
|
return remap$(v, {
|
|
44
54
|
"check_output": "checkOutput",
|
|
55
|
+
"input_sources": "inputSources",
|
|
45
56
|
"rejection_message": "rejectionMessage",
|
|
46
57
|
});
|
|
47
58
|
});
|
|
@@ -50,6 +61,7 @@ export type ClusterDefaultRuleSummary$Outbound = {
|
|
|
50
61
|
mode: string;
|
|
51
62
|
enabled: boolean;
|
|
52
63
|
check_output?: boolean | undefined;
|
|
64
|
+
input_sources: Array<string>;
|
|
53
65
|
rejection_message?: string | undefined;
|
|
54
66
|
};
|
|
55
67
|
|
|
@@ -62,10 +74,12 @@ export const ClusterDefaultRuleSummary$outboundSchema: z.ZodType<
|
|
|
62
74
|
mode: GuardrailMode$outboundSchema,
|
|
63
75
|
enabled: z.boolean(),
|
|
64
76
|
checkOutput: z.boolean().optional(),
|
|
77
|
+
inputSources: z.array(GuardrailInputSource$outboundSchema),
|
|
65
78
|
rejectionMessage: z.string().optional(),
|
|
66
79
|
}).transform((v) => {
|
|
67
80
|
return remap$(v, {
|
|
68
81
|
checkOutput: "check_output",
|
|
82
|
+
inputSources: "input_sources",
|
|
69
83
|
rejectionMessage: "rejection_message",
|
|
70
84
|
});
|
|
71
85
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A source of model input: user (user messages and text sent to a sleeping response), system (system and developer messages, instructions and compaction summaries), assistant (earlier assistant messages), tool (function, custom tool, MCP, shell and code interpreter results), retrieval (file search, web search, web page, uploaded file and history search results), image (text read from images in messages) or audio (transcripts of audio in messages)
|
|
10
|
+
*/
|
|
11
|
+
export const GuardrailInputSource = {
|
|
12
|
+
User: "user",
|
|
13
|
+
System: "system",
|
|
14
|
+
Assistant: "assistant",
|
|
15
|
+
Tool: "tool",
|
|
16
|
+
Retrieval: "retrieval",
|
|
17
|
+
Image: "image",
|
|
18
|
+
Audio: "audio",
|
|
19
|
+
} as const;
|
|
20
|
+
/**
|
|
21
|
+
* A source of model input: user (user messages and text sent to a sleeping response), system (system and developer messages, instructions and compaction summaries), assistant (earlier assistant messages), tool (function, custom tool, MCP, shell and code interpreter results), retrieval (file search, web search, web page, uploaded file and history search results), image (text read from images in messages) or audio (transcripts of audio in messages)
|
|
22
|
+
*/
|
|
23
|
+
export type GuardrailInputSource = ClosedEnum<typeof GuardrailInputSource>;
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const GuardrailInputSource$inboundSchema: z.ZodNativeEnum<
|
|
27
|
+
typeof GuardrailInputSource
|
|
28
|
+
> = z.nativeEnum(GuardrailInputSource);
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const GuardrailInputSource$outboundSchema: z.ZodNativeEnum<
|
|
31
|
+
typeof GuardrailInputSource
|
|
32
|
+
> = GuardrailInputSource$inboundSchema;
|
|
@@ -404,6 +404,7 @@ export * from "./grammarformat.js";
|
|
|
404
404
|
export * from "./grantablevectorstorepermissionrole.js";
|
|
405
405
|
export * from "./grantpermissionrequest.js";
|
|
406
406
|
export * from "./guardrailconfig.js";
|
|
407
|
+
export * from "./guardrailinputsource.js";
|
|
407
408
|
export * from "./guardrailmode.js";
|
|
408
409
|
export * from "./guardrailspolicy.js";
|
|
409
410
|
export * from "./historytooldefinition.js";
|
|
@@ -7,6 +7,11 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
GuardrailInputSource,
|
|
12
|
+
GuardrailInputSource$inboundSchema,
|
|
13
|
+
GuardrailInputSource$outboundSchema,
|
|
14
|
+
} from "./guardrailinputsource.js";
|
|
10
15
|
import {
|
|
11
16
|
LeakageConfig,
|
|
12
17
|
LeakageConfig$inboundSchema,
|
|
@@ -27,6 +32,10 @@ export type LeakageGuardrail = {
|
|
|
27
32
|
* Also apply this guardrail to model output, not just the request
|
|
28
33
|
*/
|
|
29
34
|
checkOutput?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* 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
|
+
*/
|
|
38
|
+
inputSources?: Array<GuardrailInputSource> | undefined;
|
|
30
39
|
/**
|
|
31
40
|
* Configuration for system prompt leakage detection guardrail
|
|
32
41
|
*/
|
|
@@ -42,10 +51,12 @@ export const LeakageGuardrail$inboundSchema: z.ZodType<
|
|
|
42
51
|
mode: z.literal("leakage"),
|
|
43
52
|
enabled: z.boolean().default(true),
|
|
44
53
|
check_output: z.boolean().optional(),
|
|
54
|
+
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
45
55
|
config: LeakageConfig$inboundSchema.optional(),
|
|
46
56
|
}).transform((v) => {
|
|
47
57
|
return remap$(v, {
|
|
48
58
|
"check_output": "checkOutput",
|
|
59
|
+
"input_sources": "inputSources",
|
|
49
60
|
});
|
|
50
61
|
});
|
|
51
62
|
/** @internal */
|
|
@@ -53,6 +64,7 @@ export type LeakageGuardrail$Outbound = {
|
|
|
53
64
|
mode: "leakage";
|
|
54
65
|
enabled: boolean;
|
|
55
66
|
check_output?: boolean | undefined;
|
|
67
|
+
input_sources?: Array<string> | undefined;
|
|
56
68
|
config?: LeakageConfig$Outbound | undefined;
|
|
57
69
|
};
|
|
58
70
|
|
|
@@ -65,10 +77,12 @@ export const LeakageGuardrail$outboundSchema: z.ZodType<
|
|
|
65
77
|
mode: z.literal("leakage"),
|
|
66
78
|
enabled: z.boolean().default(true),
|
|
67
79
|
checkOutput: z.boolean().optional(),
|
|
80
|
+
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
68
81
|
config: LeakageConfig$outboundSchema.optional(),
|
|
69
82
|
}).transform((v) => {
|
|
70
83
|
return remap$(v, {
|
|
71
84
|
checkOutput: "check_output",
|
|
85
|
+
inputSources: "input_sources",
|
|
72
86
|
});
|
|
73
87
|
});
|
|
74
88
|
|
|
@@ -7,6 +7,11 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
GuardrailInputSource,
|
|
12
|
+
GuardrailInputSource$inboundSchema,
|
|
13
|
+
GuardrailInputSource$outboundSchema,
|
|
14
|
+
} from "./guardrailinputsource.js";
|
|
10
15
|
import {
|
|
11
16
|
PromptInjectionConfig,
|
|
12
17
|
PromptInjectionConfig$inboundSchema,
|
|
@@ -27,6 +32,10 @@ export type PromptInjectionGuardrail = {
|
|
|
27
32
|
* Also apply this guardrail to model output, not just the request
|
|
28
33
|
*/
|
|
29
34
|
checkOutput?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* 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
|
+
*/
|
|
38
|
+
inputSources?: Array<GuardrailInputSource> | undefined;
|
|
30
39
|
/**
|
|
31
40
|
* Configuration for prompt injection detection guardrail
|
|
32
41
|
*/
|
|
@@ -42,10 +51,12 @@ export const PromptInjectionGuardrail$inboundSchema: z.ZodType<
|
|
|
42
51
|
mode: z.literal("prompt_injection"),
|
|
43
52
|
enabled: z.boolean().default(true),
|
|
44
53
|
check_output: z.boolean().optional(),
|
|
54
|
+
input_sources: z.array(GuardrailInputSource$inboundSchema).optional(),
|
|
45
55
|
config: PromptInjectionConfig$inboundSchema.optional(),
|
|
46
56
|
}).transform((v) => {
|
|
47
57
|
return remap$(v, {
|
|
48
58
|
"check_output": "checkOutput",
|
|
59
|
+
"input_sources": "inputSources",
|
|
49
60
|
});
|
|
50
61
|
});
|
|
51
62
|
/** @internal */
|
|
@@ -53,6 +64,7 @@ export type PromptInjectionGuardrail$Outbound = {
|
|
|
53
64
|
mode: "prompt_injection";
|
|
54
65
|
enabled: boolean;
|
|
55
66
|
check_output?: boolean | undefined;
|
|
67
|
+
input_sources?: Array<string> | undefined;
|
|
56
68
|
config?: PromptInjectionConfig$Outbound | undefined;
|
|
57
69
|
};
|
|
58
70
|
|
|
@@ -65,10 +77,12 @@ export const PromptInjectionGuardrail$outboundSchema: z.ZodType<
|
|
|
65
77
|
mode: z.literal("prompt_injection"),
|
|
66
78
|
enabled: z.boolean().default(true),
|
|
67
79
|
checkOutput: z.boolean().optional(),
|
|
80
|
+
inputSources: z.array(GuardrailInputSource$outboundSchema).optional(),
|
|
68
81
|
config: PromptInjectionConfig$outboundSchema.optional(),
|
|
69
82
|
}).transform((v) => {
|
|
70
83
|
return remap$(v, {
|
|
71
84
|
checkOutput: "check_output",
|
|
85
|
+
inputSources: "input_sources",
|
|
72
86
|
});
|
|
73
87
|
});
|
|
74
88
|
|
|
@@ -6,12 +6,21 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
GuardrailInputSource,
|
|
11
|
+
GuardrailInputSource$inboundSchema,
|
|
12
|
+
GuardrailInputSource$outboundSchema,
|
|
13
|
+
} from "./guardrailinputsource.js";
|
|
9
14
|
|
|
10
15
|
export type TestGuardrailsRequest = {
|
|
11
16
|
/**
|
|
12
17
|
* Content to test against guardrails
|
|
13
18
|
*/
|
|
14
19
|
content: string;
|
|
20
|
+
/**
|
|
21
|
+
* A source of model input: user (user messages and text sent to a sleeping response), system (system and developer messages, instructions and compaction summaries), assistant (earlier assistant messages), tool (function, custom tool, MCP, shell and code interpreter results), retrieval (file search, web search, web page, uploaded file and history search results), image (text read from images in messages) or audio (transcripts of audio in messages)
|
|
22
|
+
*/
|
|
23
|
+
source?: GuardrailInputSource | undefined;
|
|
15
24
|
};
|
|
16
25
|
|
|
17
26
|
/** @internal */
|
|
@@ -21,10 +30,12 @@ export const TestGuardrailsRequest$inboundSchema: z.ZodType<
|
|
|
21
30
|
unknown
|
|
22
31
|
> = z.object({
|
|
23
32
|
content: z.string(),
|
|
33
|
+
source: GuardrailInputSource$inboundSchema.optional(),
|
|
24
34
|
});
|
|
25
35
|
/** @internal */
|
|
26
36
|
export type TestGuardrailsRequest$Outbound = {
|
|
27
37
|
content: string;
|
|
38
|
+
source?: string | undefined;
|
|
28
39
|
};
|
|
29
40
|
|
|
30
41
|
/** @internal */
|
|
@@ -34,6 +45,7 @@ export const TestGuardrailsRequest$outboundSchema: z.ZodType<
|
|
|
34
45
|
TestGuardrailsRequest
|
|
35
46
|
> = z.object({
|
|
36
47
|
content: z.string(),
|
|
48
|
+
source: GuardrailInputSource$outboundSchema.optional(),
|
|
37
49
|
});
|
|
38
50
|
|
|
39
51
|
export function testGuardrailsRequestToJSON(
|