@orq-ai/node 4.12.0-rc.42 → 4.12.0-rc.43
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 +36 -38
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/evaluatorresponsefunction.js +2 -2
- package/models/components/evaluatorresponsehttp.js +2 -2
- package/models/components/evaluatorresponsejsonschema.js +2 -2
- package/models/components/evaluatorresponsellm.js +2 -2
- package/models/components/evaluatorresponsepython.js +2 -2
- package/models/components/evaluatorresponseragas.js +2 -2
- package/models/components/evaluatorresponsetypescript.js +2 -2
- package/models/components/identity.d.ts +4 -4
- package/models/components/identity.d.ts.map +1 -1
- package/models/components/identity.js +6 -6
- package/models/components/identity.js.map +1 -1
- package/models/components/index.d.ts +0 -4
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +0 -4
- package/models/components/index.js.map +1 -1
- package/models/components/reasoningpart.js +1 -1
- package/models/operations/createdataset.js +1 -1
- package/models/operations/createdatasetitem.js +5 -5
- package/models/operations/createdatasource.js +1 -1
- package/models/operations/createtool.js +6 -6
- package/models/operations/getalltools.js +6 -6
- package/models/operations/getv2humanevalsets.js +2 -2
- package/models/operations/getv2humanevalsetsid.js +2 -2
- package/models/operations/listdatasetdatapoints.js +5 -5
- package/models/operations/listdatasets.js +1 -1
- package/models/operations/listdatasources.js +1 -1
- package/models/operations/patchv2humanevalsetsid.js +2 -2
- package/models/operations/postv2feedbackevaluation.js +4 -4
- package/models/operations/postv2humanevalsets.js +2 -2
- package/models/operations/retrievedatapoint.js +5 -5
- package/models/operations/retrievedataset.js +1 -1
- package/models/operations/retrievedatasource.js +1 -1
- package/models/operations/retrievetool.js +6 -6
- package/models/operations/runagent.js +1 -1
- package/models/operations/streamrunagent.js +1 -1
- package/models/operations/updatedatapoint.js +5 -5
- package/models/operations/updatedataset.js +1 -1
- package/models/operations/updatedatasource.js +1 -1
- package/models/operations/updatetool.js +7 -7
- package/package.json +1 -1
- package/sdk/budgets.d.ts +0 -7
- package/sdk/budgets.d.ts.map +1 -1
- package/sdk/budgets.js +0 -10
- package/sdk/budgets.js.map +1 -1
- package/sdk/feedback.d.ts +2 -2
- package/sdk/feedback.js +2 -2
- package/src/lib/config.ts +2 -2
- package/src/models/components/evaluatorresponsefunction.ts +2 -2
- package/src/models/components/evaluatorresponsehttp.ts +2 -2
- package/src/models/components/evaluatorresponsejsonschema.ts +2 -2
- package/src/models/components/evaluatorresponsellm.ts +2 -2
- package/src/models/components/evaluatorresponsepython.ts +2 -2
- package/src/models/components/evaluatorresponseragas.ts +2 -2
- package/src/models/components/evaluatorresponsetypescript.ts +2 -2
- package/src/models/components/identity.ts +9 -9
- package/src/models/components/index.ts +0 -4
- package/src/models/components/reasoningpart.ts +1 -1
- package/src/models/operations/createdataset.ts +1 -1
- package/src/models/operations/createdatasetitem.ts +5 -5
- package/src/models/operations/createdatasource.ts +1 -1
- package/src/models/operations/createtool.ts +6 -6
- package/src/models/operations/getalltools.ts +6 -6
- package/src/models/operations/getv2humanevalsets.ts +2 -2
- package/src/models/operations/getv2humanevalsetsid.ts +2 -2
- package/src/models/operations/listdatasetdatapoints.ts +5 -5
- package/src/models/operations/listdatasets.ts +1 -1
- package/src/models/operations/listdatasources.ts +1 -1
- package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
- package/src/models/operations/postv2feedbackevaluation.ts +4 -4
- package/src/models/operations/postv2humanevalsets.ts +2 -2
- package/src/models/operations/retrievedatapoint.ts +5 -5
- package/src/models/operations/retrievedataset.ts +1 -1
- package/src/models/operations/retrievedatasource.ts +1 -1
- package/src/models/operations/retrievetool.ts +6 -6
- package/src/models/operations/runagent.ts +1 -1
- package/src/models/operations/streamrunagent.ts +1 -1
- package/src/models/operations/updatedatapoint.ts +5 -5
- package/src/models/operations/updatedataset.ts +1 -1
- package/src/models/operations/updatedatasource.ts +1 -1
- package/src/models/operations/updatetool.ts +7 -7
- package/src/sdk/budgets.ts +0 -18
- package/src/sdk/feedback.ts +2 -2
- package/funcs/budgetsCheck.d.ts +0 -17
- package/funcs/budgetsCheck.d.ts.map +0 -1
- package/funcs/budgetsCheck.js +0 -115
- package/funcs/budgetsCheck.js.map +0 -1
- package/models/components/budgetrejection.d.ts +0 -17
- package/models/components/budgetrejection.d.ts.map +0 -1
- package/models/components/budgetrejection.js +0 -60
- package/models/components/budgetrejection.js.map +0 -1
- package/models/components/checkbudgetsrequest.d.ts +0 -72
- package/models/components/checkbudgetsrequest.d.ts.map +0 -1
- package/models/components/checkbudgetsrequest.js +0 -69
- package/models/components/checkbudgetsrequest.js.map +0 -1
- package/models/components/checkbudgetsresponse.d.ts +0 -34
- package/models/components/checkbudgetsresponse.d.ts.map +0 -1
- package/models/components/checkbudgetsresponse.js +0 -56
- package/models/components/checkbudgetsresponse.js.map +0 -1
- package/models/components/dimensioninfo.d.ts +0 -15
- package/models/components/dimensioninfo.d.ts.map +0 -1
- package/models/components/dimensioninfo.js +0 -57
- package/models/components/dimensioninfo.js.map +0 -1
- package/src/funcs/budgetsCheck.ts +0 -162
- package/src/models/components/budgetrejection.ts +0 -48
- package/src/models/components/checkbudgetsrequest.ts +0 -111
- package/src/models/components/checkbudgetsresponse.ts +0 -62
- package/src/models/components/dimensioninfo.ts +0 -43
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.CheckBudgetsResponse$inboundSchema = void 0;
|
|
40
|
-
exports.checkBudgetsResponseFromJSON = checkBudgetsResponseFromJSON;
|
|
41
|
-
const z = __importStar(require("zod/v3"));
|
|
42
|
-
const schemas_js_1 = require("../../lib/schemas.js");
|
|
43
|
-
const budgetrejection_js_1 = require("./budgetrejection.js");
|
|
44
|
-
const dimensioninfo_js_1 = require("./dimensioninfo.js");
|
|
45
|
-
/** @internal */
|
|
46
|
-
exports.CheckBudgetsResponse$inboundSchema = z.object({
|
|
47
|
-
allowed: z.boolean().optional(),
|
|
48
|
-
rejection: budgetrejection_js_1.BudgetRejection$inboundSchema.optional(),
|
|
49
|
-
cost: dimensioninfo_js_1.DimensionInfo$inboundSchema.optional(),
|
|
50
|
-
tokens: dimensioninfo_js_1.DimensionInfo$inboundSchema.optional(),
|
|
51
|
-
requests: dimensioninfo_js_1.DimensionInfo$inboundSchema.optional(),
|
|
52
|
-
});
|
|
53
|
-
function checkBudgetsResponseFromJSON(jsonString) {
|
|
54
|
-
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CheckBudgetsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CheckBudgetsResponse' from JSON`);
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=checkbudgetsresponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbudgetsresponse.js","sourceRoot":"","sources":["../../src/models/components/checkbudgetsresponse.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDH,oEAQC;AAzDD,0CAA4B;AAC5B,qDAAiD;AAGjD,6DAG8B;AAC9B,yDAAgF;AA4BhF,gBAAgB;AACH,QAAA,kCAAkC,GAI3C,CAAC,CAAC,MAAM,CAAC;IACX,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,kDAA6B,CAAC,QAAQ,EAAE;IACnD,IAAI,EAAE,8CAA2B,CAAC,QAAQ,EAAE;IAC5C,MAAM,EAAE,8CAA2B,CAAC,QAAQ,EAAE;IAC9C,QAAQ,EAAE,8CAA2B,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC;AAEH,SAAgB,4BAA4B,CAC1C,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,0CAAkC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC9D,kDAAkD,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as z from "zod/v3";
|
|
2
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
-
/**
|
|
5
|
-
* DimensionInfo carries limit/remaining/reset for a single dimension.
|
|
6
|
-
*/
|
|
7
|
-
export type DimensionInfo = {
|
|
8
|
-
limit?: number | undefined;
|
|
9
|
-
remaining?: number | undefined;
|
|
10
|
-
resetSeconds?: number | undefined;
|
|
11
|
-
};
|
|
12
|
-
/** @internal */
|
|
13
|
-
export declare const DimensionInfo$inboundSchema: z.ZodType<DimensionInfo, z.ZodTypeDef, unknown>;
|
|
14
|
-
export declare function dimensionInfoFromJSON(jsonString: string): SafeParseResult<DimensionInfo, SDKValidationError>;
|
|
15
|
-
//# sourceMappingURL=dimensioninfo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dimensioninfo.d.ts","sourceRoot":"","sources":["../../src/models/components/dimensioninfo.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;AAErE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,EAAE,CAAC,CAAC,OAAO,CACjD,aAAa,EACb,CAAC,CAAC,UAAU,EACZ,OAAO,CASP,CAAC;AAEH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAMpD"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.DimensionInfo$inboundSchema = void 0;
|
|
40
|
-
exports.dimensionInfoFromJSON = dimensionInfoFromJSON;
|
|
41
|
-
const z = __importStar(require("zod/v3"));
|
|
42
|
-
const primitives_js_1 = require("../../lib/primitives.js");
|
|
43
|
-
const schemas_js_1 = require("../../lib/schemas.js");
|
|
44
|
-
/** @internal */
|
|
45
|
-
exports.DimensionInfo$inboundSchema = z.object({
|
|
46
|
-
limit: z.number().optional(),
|
|
47
|
-
remaining: z.number().optional(),
|
|
48
|
-
reset_seconds: z.number().int().optional(),
|
|
49
|
-
}).transform((v) => {
|
|
50
|
-
return (0, primitives_js_1.remap)(v, {
|
|
51
|
-
"reset_seconds": "resetSeconds",
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
function dimensionInfoFromJSON(jsonString) {
|
|
55
|
-
return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.DimensionInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DimensionInfo' from JSON`);
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=dimensioninfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dimensioninfo.js","sourceRoot":"","sources":["../../src/models/components/dimensioninfo.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCH,sDAQC;AAtCD,0CAA4B;AAC5B,2DAA0D;AAC1D,qDAAiD;AAajD,gBAAgB;AACH,QAAA,2BAA2B,GAIpC,CAAC,CAAC,MAAM,CAAC;IACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,OAAO,IAAA,qBAAM,EAAC,CAAC,EAAE;QACf,eAAe,EAAE,cAAc;KAChC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAgB,qBAAqB,CACnC,UAAkB;IAElB,OAAO,IAAA,sBAAS,EACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,mCAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACvD,2CAA2C,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { OrqCore } from "../core.js";
|
|
6
|
-
import { encodeJSON } 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 * as components from "../models/components/index.js";
|
|
15
|
-
import {
|
|
16
|
-
ConnectionError,
|
|
17
|
-
InvalidRequestError,
|
|
18
|
-
RequestAbortedError,
|
|
19
|
-
RequestTimeoutError,
|
|
20
|
-
UnexpectedClientError,
|
|
21
|
-
} from "../models/errors/httpclienterrors.js";
|
|
22
|
-
import { OrqError } from "../models/errors/orqerror.js";
|
|
23
|
-
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
-
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
-
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
-
import { Result } from "../types/fp.js";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Check budget enforcement
|
|
30
|
-
*
|
|
31
|
-
* @remarks
|
|
32
|
-
* Internal endpoint used by the gateway to resolve applicable budgets and check enforcement gates for a request. Returns allowed/rejected status with dimension info for rate-limit headers.
|
|
33
|
-
*/
|
|
34
|
-
export function budgetsCheck(
|
|
35
|
-
client: OrqCore,
|
|
36
|
-
request: components.CheckBudgetsRequest,
|
|
37
|
-
options?: RequestOptions,
|
|
38
|
-
): APIPromise<
|
|
39
|
-
Result<
|
|
40
|
-
components.CheckBudgetsResponse,
|
|
41
|
-
| OrqError
|
|
42
|
-
| ResponseValidationError
|
|
43
|
-
| ConnectionError
|
|
44
|
-
| RequestAbortedError
|
|
45
|
-
| RequestTimeoutError
|
|
46
|
-
| InvalidRequestError
|
|
47
|
-
| UnexpectedClientError
|
|
48
|
-
| SDKValidationError
|
|
49
|
-
>
|
|
50
|
-
> {
|
|
51
|
-
return new APIPromise($do(
|
|
52
|
-
client,
|
|
53
|
-
request,
|
|
54
|
-
options,
|
|
55
|
-
));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async function $do(
|
|
59
|
-
client: OrqCore,
|
|
60
|
-
request: components.CheckBudgetsRequest,
|
|
61
|
-
options?: RequestOptions,
|
|
62
|
-
): Promise<
|
|
63
|
-
[
|
|
64
|
-
Result<
|
|
65
|
-
components.CheckBudgetsResponse,
|
|
66
|
-
| OrqError
|
|
67
|
-
| ResponseValidationError
|
|
68
|
-
| ConnectionError
|
|
69
|
-
| RequestAbortedError
|
|
70
|
-
| RequestTimeoutError
|
|
71
|
-
| InvalidRequestError
|
|
72
|
-
| UnexpectedClientError
|
|
73
|
-
| SDKValidationError
|
|
74
|
-
>,
|
|
75
|
-
APICall,
|
|
76
|
-
]
|
|
77
|
-
> {
|
|
78
|
-
const parsed = safeParse(
|
|
79
|
-
request,
|
|
80
|
-
(value) => components.CheckBudgetsRequest$outboundSchema.parse(value),
|
|
81
|
-
"Input validation failed",
|
|
82
|
-
);
|
|
83
|
-
if (!parsed.ok) {
|
|
84
|
-
return [parsed, { status: "invalid" }];
|
|
85
|
-
}
|
|
86
|
-
const payload = parsed.value;
|
|
87
|
-
const body = encodeJSON("body", payload, { explode: true });
|
|
88
|
-
|
|
89
|
-
const path = pathToFunc("/v2/budgets/check")();
|
|
90
|
-
|
|
91
|
-
const headers = new Headers(compactMap({
|
|
92
|
-
"Content-Type": "application/json",
|
|
93
|
-
Accept: "application/json",
|
|
94
|
-
}));
|
|
95
|
-
|
|
96
|
-
const secConfig = await extractSecurity(client._options.apiKey);
|
|
97
|
-
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
98
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
99
|
-
|
|
100
|
-
const context = {
|
|
101
|
-
options: client._options,
|
|
102
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
103
|
-
operationID: "BudgetCheck",
|
|
104
|
-
oAuth2Scopes: null,
|
|
105
|
-
|
|
106
|
-
resolvedSecurity: requestSecurity,
|
|
107
|
-
|
|
108
|
-
securitySource: client._options.apiKey,
|
|
109
|
-
retryConfig: options?.retries
|
|
110
|
-
|| client._options.retryConfig
|
|
111
|
-
|| { strategy: "none" },
|
|
112
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const requestRes = client._createRequest(context, {
|
|
116
|
-
security: requestSecurity,
|
|
117
|
-
method: "POST",
|
|
118
|
-
baseURL: options?.serverURL,
|
|
119
|
-
path: path,
|
|
120
|
-
headers: headers,
|
|
121
|
-
body: body,
|
|
122
|
-
userAgent: client._options.userAgent,
|
|
123
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
|
|
124
|
-
}, options);
|
|
125
|
-
if (!requestRes.ok) {
|
|
126
|
-
return [requestRes, { status: "invalid" }];
|
|
127
|
-
}
|
|
128
|
-
const req = requestRes.value;
|
|
129
|
-
|
|
130
|
-
const doResult = await client._do(req, {
|
|
131
|
-
context,
|
|
132
|
-
isErrorStatusCode: (statusCode: number) =>
|
|
133
|
-
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
134
|
-
retryConfig: context.retryConfig,
|
|
135
|
-
retryCodes: context.retryCodes,
|
|
136
|
-
});
|
|
137
|
-
if (!doResult.ok) {
|
|
138
|
-
return [doResult, { status: "request-error", request: req }];
|
|
139
|
-
}
|
|
140
|
-
const response = doResult.value;
|
|
141
|
-
|
|
142
|
-
const [result] = await M.match<
|
|
143
|
-
components.CheckBudgetsResponse,
|
|
144
|
-
| OrqError
|
|
145
|
-
| ResponseValidationError
|
|
146
|
-
| ConnectionError
|
|
147
|
-
| RequestAbortedError
|
|
148
|
-
| RequestTimeoutError
|
|
149
|
-
| InvalidRequestError
|
|
150
|
-
| UnexpectedClientError
|
|
151
|
-
| SDKValidationError
|
|
152
|
-
>(
|
|
153
|
-
M.json(200, components.CheckBudgetsResponse$inboundSchema),
|
|
154
|
-
M.fail("4XX"),
|
|
155
|
-
M.fail("5XX"),
|
|
156
|
-
)(response, req);
|
|
157
|
-
if (!result.ok) {
|
|
158
|
-
return [result, { status: "complete", request: req, response }];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return [result, { status: "complete", request: req, response }];
|
|
162
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v3";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* BudgetRejection identifies the budget that caused a 429.
|
|
13
|
-
*/
|
|
14
|
-
export type BudgetRejection = {
|
|
15
|
-
scopeKind?: string | undefined;
|
|
16
|
-
scopeTargetId?: string | undefined;
|
|
17
|
-
dimension?: string | undefined;
|
|
18
|
-
code?: string | undefined;
|
|
19
|
-
message?: string | undefined;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/** @internal */
|
|
23
|
-
export const BudgetRejection$inboundSchema: z.ZodType<
|
|
24
|
-
BudgetRejection,
|
|
25
|
-
z.ZodTypeDef,
|
|
26
|
-
unknown
|
|
27
|
-
> = z.object({
|
|
28
|
-
scope_kind: z.string().optional(),
|
|
29
|
-
scope_target_id: z.string().optional(),
|
|
30
|
-
dimension: z.string().optional(),
|
|
31
|
-
code: z.string().optional(),
|
|
32
|
-
message: z.string().optional(),
|
|
33
|
-
}).transform((v) => {
|
|
34
|
-
return remap$(v, {
|
|
35
|
-
"scope_kind": "scopeKind",
|
|
36
|
-
"scope_target_id": "scopeTargetId",
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export function budgetRejectionFromJSON(
|
|
41
|
-
jsonString: string,
|
|
42
|
-
): SafeParseResult<BudgetRejection, SDKValidationError> {
|
|
43
|
-
return safeParse(
|
|
44
|
-
jsonString,
|
|
45
|
-
(x) => BudgetRejection$inboundSchema.parse(JSON.parse(x)),
|
|
46
|
-
`Failed to parse 'BudgetRejection' from JSON`,
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Request metadata forwarded for dynamic-budget matching
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* (`metadata.team == "ml"`). Free-form JSON object from the request
|
|
13
|
-
* body's `metadata` field.
|
|
14
|
-
*/
|
|
15
|
-
export type Metadata = {};
|
|
16
|
-
|
|
17
|
-
export type CheckBudgetsRequest = {
|
|
18
|
-
/**
|
|
19
|
-
* API key that issued the request; ignored — the gate uses the caller's own key.
|
|
20
|
-
*/
|
|
21
|
-
apiKeyId?: string | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Project the request targets; must be within the caller's scope.
|
|
24
|
-
*/
|
|
25
|
-
projectId?: string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Identity external id for contact-scoped budgets (if any).
|
|
28
|
-
*/
|
|
29
|
-
identityExternalId?: string | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Provider enum value for provider-scoped budgets (if any).
|
|
32
|
-
*/
|
|
33
|
-
provider?: string | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Full model reference for model-scoped budgets (if any), exactly as
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* the caller sent it: "provider/model" or "workspaceKey@provider/model".
|
|
39
|
-
*/
|
|
40
|
-
modelId?: string | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Request metadata forwarded for dynamic-budget matching
|
|
43
|
-
*
|
|
44
|
-
* @remarks
|
|
45
|
-
* (`metadata.team == "ml"`). Free-form JSON object from the request
|
|
46
|
-
* body's `metadata` field.
|
|
47
|
-
*/
|
|
48
|
-
metadata?: Metadata | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Request headers (lowercase keys) forwarded for dynamic-budget
|
|
51
|
-
*
|
|
52
|
-
* @remarks
|
|
53
|
-
* matching (`headers["x-env"] == "prod"`).
|
|
54
|
-
*/
|
|
55
|
-
headers?: { [k: string]: string } | undefined;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** @internal */
|
|
59
|
-
export type Metadata$Outbound = {};
|
|
60
|
-
|
|
61
|
-
/** @internal */
|
|
62
|
-
export const Metadata$outboundSchema: z.ZodType<
|
|
63
|
-
Metadata$Outbound,
|
|
64
|
-
z.ZodTypeDef,
|
|
65
|
-
Metadata
|
|
66
|
-
> = z.object({});
|
|
67
|
-
|
|
68
|
-
export function metadataToJSON(metadata: Metadata): string {
|
|
69
|
-
return JSON.stringify(Metadata$outboundSchema.parse(metadata));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** @internal */
|
|
73
|
-
export type CheckBudgetsRequest$Outbound = {
|
|
74
|
-
api_key_id?: string | undefined;
|
|
75
|
-
project_id?: string | undefined;
|
|
76
|
-
identity_external_id?: string | undefined;
|
|
77
|
-
provider?: string | undefined;
|
|
78
|
-
model_id?: string | undefined;
|
|
79
|
-
metadata?: Metadata$Outbound | undefined;
|
|
80
|
-
headers?: { [k: string]: string } | undefined;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/** @internal */
|
|
84
|
-
export const CheckBudgetsRequest$outboundSchema: z.ZodType<
|
|
85
|
-
CheckBudgetsRequest$Outbound,
|
|
86
|
-
z.ZodTypeDef,
|
|
87
|
-
CheckBudgetsRequest
|
|
88
|
-
> = z.object({
|
|
89
|
-
apiKeyId: z.string().optional(),
|
|
90
|
-
projectId: z.string().optional(),
|
|
91
|
-
identityExternalId: z.string().optional(),
|
|
92
|
-
provider: z.string().optional(),
|
|
93
|
-
modelId: z.string().optional(),
|
|
94
|
-
metadata: z.lazy(() => Metadata$outboundSchema).optional(),
|
|
95
|
-
headers: z.record(z.string()).optional(),
|
|
96
|
-
}).transform((v) => {
|
|
97
|
-
return remap$(v, {
|
|
98
|
-
apiKeyId: "api_key_id",
|
|
99
|
-
projectId: "project_id",
|
|
100
|
-
identityExternalId: "identity_external_id",
|
|
101
|
-
modelId: "model_id",
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
export function checkBudgetsRequestToJSON(
|
|
106
|
-
checkBudgetsRequest: CheckBudgetsRequest,
|
|
107
|
-
): string {
|
|
108
|
-
return JSON.stringify(
|
|
109
|
-
CheckBudgetsRequest$outboundSchema.parse(checkBudgetsRequest),
|
|
110
|
-
);
|
|
111
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v3";
|
|
6
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
-
import {
|
|
10
|
-
BudgetRejection,
|
|
11
|
-
BudgetRejection$inboundSchema,
|
|
12
|
-
} from "./budgetrejection.js";
|
|
13
|
-
import { DimensionInfo, DimensionInfo$inboundSchema } from "./dimensioninfo.js";
|
|
14
|
-
|
|
15
|
-
export type CheckBudgetsResponse = {
|
|
16
|
-
/**
|
|
17
|
-
* True when no applicable budget exceeds its limit.
|
|
18
|
-
*/
|
|
19
|
-
allowed?: boolean | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Populated when allowed is false; identifies which budget and
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* dimension triggered the rejection.
|
|
25
|
-
*/
|
|
26
|
-
rejection?: BudgetRejection | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Cost dimension info for rate-limit headers (nil when no cost budget applies).
|
|
29
|
-
*/
|
|
30
|
-
cost?: DimensionInfo | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Token dimension info for rate-limit headers (nil when no token budget applies).
|
|
33
|
-
*/
|
|
34
|
-
tokens?: DimensionInfo | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Requests dimension info for rate-limit headers (nil when no RPM budget applies).
|
|
37
|
-
*/
|
|
38
|
-
requests?: DimensionInfo | undefined;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/** @internal */
|
|
42
|
-
export const CheckBudgetsResponse$inboundSchema: z.ZodType<
|
|
43
|
-
CheckBudgetsResponse,
|
|
44
|
-
z.ZodTypeDef,
|
|
45
|
-
unknown
|
|
46
|
-
> = z.object({
|
|
47
|
-
allowed: z.boolean().optional(),
|
|
48
|
-
rejection: BudgetRejection$inboundSchema.optional(),
|
|
49
|
-
cost: DimensionInfo$inboundSchema.optional(),
|
|
50
|
-
tokens: DimensionInfo$inboundSchema.optional(),
|
|
51
|
-
requests: DimensionInfo$inboundSchema.optional(),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export function checkBudgetsResponseFromJSON(
|
|
55
|
-
jsonString: string,
|
|
56
|
-
): SafeParseResult<CheckBudgetsResponse, SDKValidationError> {
|
|
57
|
-
return safeParse(
|
|
58
|
-
jsonString,
|
|
59
|
-
(x) => CheckBudgetsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
60
|
-
`Failed to parse 'CheckBudgetsResponse' from JSON`,
|
|
61
|
-
);
|
|
62
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v3";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* DimensionInfo carries limit/remaining/reset for a single dimension.
|
|
13
|
-
*/
|
|
14
|
-
export type DimensionInfo = {
|
|
15
|
-
limit?: number | undefined;
|
|
16
|
-
remaining?: number | undefined;
|
|
17
|
-
resetSeconds?: number | undefined;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/** @internal */
|
|
21
|
-
export const DimensionInfo$inboundSchema: z.ZodType<
|
|
22
|
-
DimensionInfo,
|
|
23
|
-
z.ZodTypeDef,
|
|
24
|
-
unknown
|
|
25
|
-
> = z.object({
|
|
26
|
-
limit: z.number().optional(),
|
|
27
|
-
remaining: z.number().optional(),
|
|
28
|
-
reset_seconds: z.number().int().optional(),
|
|
29
|
-
}).transform((v) => {
|
|
30
|
-
return remap$(v, {
|
|
31
|
-
"reset_seconds": "resetSeconds",
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export function dimensionInfoFromJSON(
|
|
36
|
-
jsonString: string,
|
|
37
|
-
): SafeParseResult<DimensionInfo, SDKValidationError> {
|
|
38
|
-
return safeParse(
|
|
39
|
-
jsonString,
|
|
40
|
-
(x) => DimensionInfo$inboundSchema.parse(JSON.parse(x)),
|
|
41
|
-
`Failed to parse 'DimensionInfo' from JSON`,
|
|
42
|
-
);
|
|
43
|
-
}
|