@orq-ai/node 4.11.3 → 4.11.9
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 +40 -36
- package/funcs/modelsImportLitellm.d.ts +17 -0
- package/funcs/modelsImportLitellm.d.ts.map +1 -0
- package/funcs/modelsImportLitellm.js +118 -0
- package/funcs/modelsImportLitellm.js.map +1 -0
- package/funcs/modelsListLitellm.d.ts +18 -0
- package/funcs/modelsListLitellm.d.ts.map +1 -0
- package/funcs/modelsListLitellm.js +105 -0
- package/funcs/modelsListLitellm.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/http.d.ts +1 -1
- package/lib/http.d.ts.map +1 -1
- package/lib/http.js +1 -1
- package/lib/http.js.map +1 -1
- package/lib/security.d.ts +5 -4
- package/lib/security.d.ts.map +1 -1
- package/lib/security.js +6 -7
- package/lib/security.js.map +1 -1
- 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/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/litellmmodel.d.ts +18 -0
- package/models/components/litellmmodel.d.ts.map +1 -0
- package/models/components/litellmmodel.js +60 -0
- package/models/components/litellmmodel.js.map +1 -0
- package/models/components/litellmmodelinfo.d.ts +44 -0
- package/models/components/litellmmodelinfo.d.ts.map +1 -0
- package/models/components/litellmmodelinfo.js +83 -0
- package/models/components/litellmmodelinfo.js.map +1 -0
- package/models/components/litellmparams.d.ts +18 -0
- package/models/components/litellmparams.d.ts.map +1 -0
- package/models/components/litellmparams.js +59 -0
- package/models/components/litellmparams.js.map +1 -0
- package/models/components/modeldocument.d.ts +39 -0
- package/models/components/modeldocument.d.ts.map +1 -0
- package/models/components/modeldocument.js +99 -0
- package/models/components/modeldocument.js.map +1 -0
- package/models/components/reasoningpart.js +1 -1
- package/models/operations/createdataset.js +1 -1
- package/models/operations/createdatasetitem.js +4 -4
- package/models/operations/createdatasource.js +1 -1
- package/models/operations/createprompt.d.ts +3 -0
- package/models/operations/createprompt.d.ts.map +1 -1
- package/models/operations/createprompt.js +3 -0
- package/models/operations/createprompt.js.map +1 -1
- package/models/operations/createtool.js +6 -6
- package/models/operations/deploymentinvoke.d.ts +3 -0
- package/models/operations/deploymentinvoke.d.ts.map +1 -1
- package/models/operations/deploymentinvoke.js +3 -0
- package/models/operations/deploymentinvoke.js.map +1 -1
- package/models/operations/deployments.d.ts +3 -0
- package/models/operations/deployments.d.ts.map +1 -1
- package/models/operations/deployments.js +3 -0
- package/models/operations/deployments.js.map +1 -1
- package/models/operations/deploymentstream.d.ts +3 -0
- package/models/operations/deploymentstream.d.ts.map +1 -1
- package/models/operations/deploymentstream.js +3 -0
- package/models/operations/deploymentstream.js.map +1 -1
- package/models/operations/getallprompts.d.ts +3 -0
- package/models/operations/getallprompts.d.ts.map +1 -1
- package/models/operations/getallprompts.js +3 -0
- package/models/operations/getallprompts.js.map +1 -1
- package/models/operations/getalltools.js +6 -6
- package/models/operations/getoneprompt.d.ts +3 -0
- package/models/operations/getoneprompt.d.ts.map +1 -1
- package/models/operations/getoneprompt.js +3 -0
- package/models/operations/getoneprompt.js.map +1 -1
- package/models/operations/getpromptversion.d.ts +3 -0
- package/models/operations/getpromptversion.d.ts.map +1 -1
- package/models/operations/getpromptversion.js +3 -0
- package/models/operations/getpromptversion.js.map +1 -1
- package/models/operations/getv2humanevalsets.js +2 -2
- package/models/operations/getv2humanevalsetsid.js +2 -2
- package/models/operations/invokeeval.d.ts +1 -1
- package/models/operations/invokeeval.d.ts.map +1 -1
- package/models/operations/invokeeval.js +1 -1
- package/models/operations/invokeeval.js.map +1 -1
- package/models/operations/listdatasetdatapoints.js +4 -4
- package/models/operations/listdatasets.js +1 -1
- package/models/operations/listdatasources.js +1 -1
- package/models/operations/listpromptversions.d.ts +3 -0
- package/models/operations/listpromptversions.d.ts.map +1 -1
- package/models/operations/listpromptversions.js +3 -0
- package/models/operations/listpromptversions.js.map +1 -1
- package/models/operations/patchv2humanevalsetsid.js +2 -2
- package/models/operations/postv2feedbackevaluation.js +3 -3
- package/models/operations/postv2humanevalsets.js +2 -2
- package/models/operations/retrievedatapoint.js +4 -4
- 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 +4 -4
- package/models/operations/updatedataset.js +1 -1
- package/models/operations/updatedatasource.js +1 -1
- package/models/operations/updateprompt.d.ts +3 -0
- package/models/operations/updateprompt.d.ts.map +1 -1
- package/models/operations/updateprompt.js +3 -0
- package/models/operations/updateprompt.js.map +1 -1
- package/models/operations/updatetool.js +7 -7
- package/package.json +6 -6
- package/packages/orq-rc/src/funcs/agentsResponsesCreate.ts +2 -0
- package/packages/orq-rc/src/funcs/agentsResponsesGet.ts +2 -0
- package/packages/orq-rc/src/funcs/modelsImportLitellm.ts +166 -0
- package/packages/orq-rc/src/funcs/modelsListLitellm.ts +144 -0
- package/packages/orq-rc/src/funcs/notifiersList.ts +2 -0
- package/packages/orq-rc/src/funcs/reportingQuery.ts +3 -1
- package/packages/orq-rc/src/funcs/telemetryQuery.ts +162 -0
- package/packages/orq-rc/src/funcs/tracesAggregate.ts +3 -1
- package/packages/orq-rc/src/lib/config.ts +3 -3
- package/packages/orq-rc/src/lib/http.ts +3 -1
- package/packages/orq-rc/src/lib/security.ts +10 -5
- package/packages/orq-rc/src/models/components/agentstartedstreamingevent.ts +6 -0
- package/packages/orq-rc/src/models/components/apikey.ts +6 -0
- package/packages/orq-rc/src/models/components/budget.ts +6 -0
- package/packages/orq-rc/src/models/components/budgetalert.ts +92 -0
- package/packages/orq-rc/src/models/components/budgetalertdimension.ts +22 -0
- package/packages/orq-rc/src/models/components/config.ts +44 -0
- package/packages/orq-rc/src/models/components/createbudgetrequest.ts +14 -0
- package/packages/orq-rc/src/models/components/evaluatorresponsefunction.ts +2 -2
- package/packages/orq-rc/src/models/components/evaluatorresponsehttp.ts +2 -2
- package/packages/orq-rc/src/models/components/evaluatorresponsejsonschema.ts +2 -2
- package/packages/orq-rc/src/models/components/evaluatorresponsellm.ts +2 -2
- package/packages/orq-rc/src/models/components/evaluatorresponsepython.ts +2 -2
- package/packages/orq-rc/src/models/components/evaluatorresponseragas.ts +2 -2
- package/packages/orq-rc/src/models/components/evaluatorresponsetypescript.ts +2 -2
- package/packages/orq-rc/src/models/components/filepurpose.ts +1 -0
- package/packages/orq-rc/src/models/components/identity.ts +6 -0
- package/packages/orq-rc/src/models/components/index.ts +11 -0
- package/packages/orq-rc/src/models/components/litellmmodel.ts +50 -0
- package/packages/orq-rc/src/models/components/litellmmodelinfo.ts +97 -0
- package/packages/orq-rc/src/models/components/litellmparams.ts +43 -0
- package/packages/orq-rc/src/models/components/modeldocument.ts +115 -0
- package/packages/orq-rc/src/models/components/modelsconfig.ts +1 -0
- package/packages/orq-rc/src/models/components/querytelemetrymeta.ts +38 -0
- package/packages/orq-rc/src/models/components/querytelemetryrequest.ts +85 -0
- package/packages/orq-rc/src/models/components/querytelemetryresponse.ts +42 -0
- package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
- package/packages/orq-rc/src/models/components/telemetryrow.ts +42 -0
- package/packages/orq-rc/src/models/components/thinkingconfigenabledschema.ts +1 -0
- package/packages/orq-rc/src/models/components/updatebudgetrequest.ts +21 -0
- package/packages/orq-rc/src/models/operations/createagentrequest.ts +127 -40
- package/packages/orq-rc/src/models/operations/createchatcompletion.ts +1 -0
- package/packages/orq-rc/src/models/operations/createdataset.ts +1 -1
- package/packages/orq-rc/src/models/operations/createdatasetitem.ts +237 -19
- package/packages/orq-rc/src/models/operations/createdatasource.ts +1 -1
- package/packages/orq-rc/src/models/operations/createeval.ts +179 -175
- package/packages/orq-rc/src/models/operations/createknowledge.ts +18 -10
- package/packages/orq-rc/src/models/operations/createprompt.ts +6 -0
- package/packages/orq-rc/src/models/operations/createrouterresponse.ts +127 -26
- package/packages/orq-rc/src/models/operations/createtool.ts +6 -6
- package/packages/orq-rc/src/models/operations/deploymentgetconfig.ts +1 -0
- package/packages/orq-rc/src/models/operations/deploymentinvoke.ts +3 -0
- package/packages/orq-rc/src/models/operations/deployments.ts +4 -0
- package/packages/orq-rc/src/models/operations/deploymentstream.ts +3 -0
- package/packages/orq-rc/src/models/operations/getallmemories.ts +1 -1
- package/packages/orq-rc/src/models/operations/getallmemorydocuments.ts +1 -1
- package/packages/orq-rc/src/models/operations/getallmemorystores.ts +1 -1
- package/packages/orq-rc/src/models/operations/getallprompts.ts +6 -1
- package/packages/orq-rc/src/models/operations/getalltools.ts +6 -6
- package/packages/orq-rc/src/models/operations/getevals.ts +1 -1
- package/packages/orq-rc/src/models/operations/getoneprompt.ts +5 -0
- package/packages/orq-rc/src/models/operations/getpromptversion.ts +5 -0
- package/packages/orq-rc/src/models/operations/getv2evaluatorsidversions.ts +1 -1
- package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
- package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
- package/packages/orq-rc/src/models/operations/getv2toolstoolidversions.ts +1 -1
- package/packages/orq-rc/src/models/operations/invokeeval.ts +2 -2
- package/packages/orq-rc/src/models/operations/listagents.ts +8 -0
- package/packages/orq-rc/src/models/operations/listchunks.ts +1 -1
- package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +314 -85
- package/packages/orq-rc/src/models/operations/listdatasets.ts +2 -2
- package/packages/orq-rc/src/models/operations/listdatasources.ts +1 -1
- package/packages/orq-rc/src/models/operations/listpromptversions.ts +6 -1
- package/packages/orq-rc/src/models/operations/modelcreate.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelcreateautorouter.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelcreateawsbedrock.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelcreateopenailike.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelcreatevertex.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelupdate.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelupdateautorouter.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelupdateawsbedrock.ts +2 -0
- package/packages/orq-rc/src/models/operations/modelupdateopenailike.ts +2 -0
- package/packages/orq-rc/src/models/operations/notifierlist.ts +13 -0
- package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
- package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +119 -11
- package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
- package/packages/orq-rc/src/models/operations/retrieveagentrequest.ts +8 -0
- package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +234 -9
- package/packages/orq-rc/src/models/operations/retrievedataset.ts +1 -1
- package/packages/orq-rc/src/models/operations/retrievedatasource.ts +1 -1
- package/packages/orq-rc/src/models/operations/retrievetool.ts +6 -6
- package/packages/orq-rc/src/models/operations/runagent.ts +95 -33
- package/packages/orq-rc/src/models/operations/streamrunagent.ts +101 -33
- package/packages/orq-rc/src/models/operations/updateagent.ts +129 -40
- package/packages/orq-rc/src/models/operations/updatedatapoint.ts +229 -9
- package/packages/orq-rc/src/models/operations/updatedataset.ts +1 -1
- package/packages/orq-rc/src/models/operations/updatedatasource.ts +1 -1
- package/packages/orq-rc/src/models/operations/updateprompt.ts +6 -0
- package/packages/orq-rc/src/models/operations/updatetool.ts +7 -7
- package/packages/orq-rc/src/sdk/feedback.ts +2 -2
- package/packages/orq-rc/src/sdk/humanreviewsets.ts +4 -1
- package/packages/orq-rc/src/sdk/models.ts +35 -0
- package/packages/orq-rc/src/sdk/orqresponses.ts +4 -0
- package/packages/orq-rc/src/sdk/reporting.ts +3 -1
- package/packages/orq-rc/src/sdk/sdk.ts +6 -0
- package/packages/orq-rc/src/sdk/telemetry.ts +27 -0
- package/packages/orq-rc/src/sdk/traces.ts +3 -1
- package/sdk/feedback.d.ts +2 -2
- package/sdk/feedback.js +2 -2
- package/sdk/models.d.ts +17 -0
- package/sdk/models.d.ts.map +1 -1
- package/sdk/models.js +20 -0
- package/sdk/models.js.map +1 -1
- package/src/funcs/modelsImportLitellm.ts +166 -0
- package/src/funcs/modelsListLitellm.ts +144 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/http.ts +3 -1
- package/src/lib/security.ts +10 -5
- 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/index.ts +4 -0
- package/src/models/components/litellmmodel.ts +50 -0
- package/src/models/components/litellmmodelinfo.ts +97 -0
- package/src/models/components/litellmparams.ts +43 -0
- package/src/models/components/modeldocument.ts +112 -0
- package/src/models/components/reasoningpart.ts +1 -1
- package/src/models/operations/createdataset.ts +1 -1
- package/src/models/operations/createdatasetitem.ts +4 -4
- package/src/models/operations/createdatasource.ts +1 -1
- package/src/models/operations/createprompt.ts +3 -0
- package/src/models/operations/createtool.ts +6 -6
- package/src/models/operations/deploymentinvoke.ts +3 -0
- package/src/models/operations/deployments.ts +3 -0
- package/src/models/operations/deploymentstream.ts +3 -0
- package/src/models/operations/getallprompts.ts +3 -0
- package/src/models/operations/getalltools.ts +6 -6
- package/src/models/operations/getoneprompt.ts +3 -0
- package/src/models/operations/getpromptversion.ts +3 -0
- package/src/models/operations/getv2humanevalsets.ts +2 -2
- package/src/models/operations/getv2humanevalsetsid.ts +2 -2
- package/src/models/operations/invokeeval.ts +2 -2
- package/src/models/operations/listdatasetdatapoints.ts +4 -4
- package/src/models/operations/listdatasets.ts +1 -1
- package/src/models/operations/listdatasources.ts +1 -1
- package/src/models/operations/listpromptversions.ts +3 -0
- package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
- package/src/models/operations/postv2feedbackevaluation.ts +3 -3
- package/src/models/operations/postv2humanevalsets.ts +2 -2
- package/src/models/operations/retrievedatapoint.ts +4 -4
- 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 +4 -4
- package/src/models/operations/updatedataset.ts +1 -1
- package/src/models/operations/updatedatasource.ts +1 -1
- package/src/models/operations/updateprompt.ts +3 -0
- package/src/models/operations/updatetool.ts +7 -7
- package/src/sdk/feedback.ts +2 -2
- package/src/sdk/models.ts +35 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { OrqCore } from "../core.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 { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import { OrqError } from "../models/errors/orqerror.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* List models from configured LiteLLM instance
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Fetches the list of models from the LiteLLM instance configured for the workspace. Requires a stored LiteLLM integration.
|
|
31
|
+
*/
|
|
32
|
+
export function modelsListLitellm(
|
|
33
|
+
client: OrqCore,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<
|
|
36
|
+
Result<
|
|
37
|
+
Array<{ [k: string]: any }>,
|
|
38
|
+
| OrqError
|
|
39
|
+
| ResponseValidationError
|
|
40
|
+
| ConnectionError
|
|
41
|
+
| RequestAbortedError
|
|
42
|
+
| RequestTimeoutError
|
|
43
|
+
| InvalidRequestError
|
|
44
|
+
| UnexpectedClientError
|
|
45
|
+
| SDKValidationError
|
|
46
|
+
>
|
|
47
|
+
> {
|
|
48
|
+
return new APIPromise($do(
|
|
49
|
+
client,
|
|
50
|
+
options,
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function $do(
|
|
55
|
+
client: OrqCore,
|
|
56
|
+
options?: RequestOptions,
|
|
57
|
+
): Promise<
|
|
58
|
+
[
|
|
59
|
+
Result<
|
|
60
|
+
Array<{ [k: string]: any }>,
|
|
61
|
+
| OrqError
|
|
62
|
+
| ResponseValidationError
|
|
63
|
+
| ConnectionError
|
|
64
|
+
| RequestAbortedError
|
|
65
|
+
| RequestTimeoutError
|
|
66
|
+
| InvalidRequestError
|
|
67
|
+
| UnexpectedClientError
|
|
68
|
+
| SDKValidationError
|
|
69
|
+
>,
|
|
70
|
+
APICall,
|
|
71
|
+
]
|
|
72
|
+
> {
|
|
73
|
+
const path = pathToFunc("/v2/models/litellm/models")();
|
|
74
|
+
|
|
75
|
+
const headers = new Headers(compactMap({
|
|
76
|
+
Accept: "application/json",
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
80
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
81
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
82
|
+
|
|
83
|
+
const context = {
|
|
84
|
+
options: client._options,
|
|
85
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
86
|
+
operationID: "ModelListLitellm",
|
|
87
|
+
oAuth2Scopes: null,
|
|
88
|
+
|
|
89
|
+
resolvedSecurity: requestSecurity,
|
|
90
|
+
|
|
91
|
+
securitySource: client._options.apiKey,
|
|
92
|
+
retryConfig: options?.retries
|
|
93
|
+
|| client._options.retryConfig
|
|
94
|
+
|| { strategy: "none" },
|
|
95
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const requestRes = client._createRequest(context, {
|
|
99
|
+
security: requestSecurity,
|
|
100
|
+
method: "GET",
|
|
101
|
+
baseURL: options?.serverURL,
|
|
102
|
+
path: path,
|
|
103
|
+
headers: headers,
|
|
104
|
+
userAgent: client._options.userAgent,
|
|
105
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
|
|
106
|
+
}, options);
|
|
107
|
+
if (!requestRes.ok) {
|
|
108
|
+
return [requestRes, { status: "invalid" }];
|
|
109
|
+
}
|
|
110
|
+
const req = requestRes.value;
|
|
111
|
+
|
|
112
|
+
const doResult = await client._do(req, {
|
|
113
|
+
context,
|
|
114
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
115
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
116
|
+
retryConfig: context.retryConfig,
|
|
117
|
+
retryCodes: context.retryCodes,
|
|
118
|
+
});
|
|
119
|
+
if (!doResult.ok) {
|
|
120
|
+
return [doResult, { status: "request-error", request: req }];
|
|
121
|
+
}
|
|
122
|
+
const response = doResult.value;
|
|
123
|
+
|
|
124
|
+
const [result] = await M.match<
|
|
125
|
+
Array<{ [k: string]: any }>,
|
|
126
|
+
| OrqError
|
|
127
|
+
| ResponseValidationError
|
|
128
|
+
| ConnectionError
|
|
129
|
+
| RequestAbortedError
|
|
130
|
+
| RequestTimeoutError
|
|
131
|
+
| InvalidRequestError
|
|
132
|
+
| UnexpectedClientError
|
|
133
|
+
| SDKValidationError
|
|
134
|
+
>(
|
|
135
|
+
M.json(200, z.array(z.record(z.any()))),
|
|
136
|
+
M.fail([404, "4XX"]),
|
|
137
|
+
M.fail([500, "5XX"]),
|
|
138
|
+
)(response, req);
|
|
139
|
+
if (!result.ok) {
|
|
140
|
+
return [result, { status: "complete", request: req, response }];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return [result, { status: "complete", request: req, response }];
|
|
144
|
+
}
|
|
@@ -94,7 +94,9 @@ async function $do(
|
|
|
94
94
|
"ending_before": payload?.ending_before,
|
|
95
95
|
"limit": payload?.limit,
|
|
96
96
|
"project_id": payload?.project_id,
|
|
97
|
+
"search": payload?.search,
|
|
97
98
|
"starting_after": payload?.starting_after,
|
|
99
|
+
"type": payload?.type,
|
|
98
100
|
});
|
|
99
101
|
|
|
100
102
|
const headers = new Headers(compactMap({
|
|
@@ -29,7 +29,9 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Query reporting metrics
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
* Returns time-series analytics for AI usage, cost, latency, evaluator results, and guardrail outcomes. Select a metric and time range, break results down by supported dimensions, apply filters, and optionally include totals for the full range.
|
|
32
|
+
* Deprecated: use TelemetryService.Query (POST /v2/telemetry/query) instead. Returns time-series analytics for AI usage, cost, latency, evaluator results, and guardrail outcomes. Select a metric and time range, break results down by supported dimensions, apply filters, and optionally include totals for the full range.
|
|
33
|
+
*
|
|
34
|
+
* @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
33
35
|
*/
|
|
34
36
|
export function reportingQuery(
|
|
35
37
|
client: OrqCore,
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
* Query telemetry
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Unified query envelope for traces, metrics, and logs. Selects a source, a compute list, and a time range, with optional grain, group-by, and filters; returns a time series or a single aggregate row per group.
|
|
33
|
+
*/
|
|
34
|
+
export function telemetryQuery(
|
|
35
|
+
client: OrqCore,
|
|
36
|
+
request: components.QueryTelemetryRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
components.QueryTelemetryResponse,
|
|
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.QueryTelemetryRequest,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<
|
|
63
|
+
[
|
|
64
|
+
Result<
|
|
65
|
+
components.QueryTelemetryResponse,
|
|
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.QueryTelemetryRequest$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/telemetry/query")();
|
|
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: "TelemetryQuery",
|
|
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.QueryTelemetryResponse,
|
|
144
|
+
| OrqError
|
|
145
|
+
| ResponseValidationError
|
|
146
|
+
| ConnectionError
|
|
147
|
+
| RequestAbortedError
|
|
148
|
+
| RequestTimeoutError
|
|
149
|
+
| InvalidRequestError
|
|
150
|
+
| UnexpectedClientError
|
|
151
|
+
| SDKValidationError
|
|
152
|
+
>(
|
|
153
|
+
M.json(200, components.QueryTelemetryResponse$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
|
+
}
|
|
@@ -29,7 +29,9 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Aggregate traces
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
* Aggregate trace metrics using the structured trace filter contract.
|
|
32
|
+
* Deprecated: use TelemetryService.Query (POST /v2/telemetry/query, source=TRACES, grain=none) instead. Aggregate trace metrics using the structured trace filter contract.
|
|
33
|
+
*
|
|
34
|
+
* @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
33
35
|
*/
|
|
34
36
|
export function tracesAggregate(
|
|
35
37
|
client: OrqCore,
|
|
@@ -58,7 +58,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
58
58
|
export const SDK_METADATA = {
|
|
59
59
|
language: "typescript",
|
|
60
60
|
openapiDocVersion: "2.0",
|
|
61
|
-
sdkVersion: "4.12.0-rc.
|
|
62
|
-
genVersion: "2.
|
|
63
|
-
userAgent: "speakeasy-sdk/typescript 4.12.0-rc.
|
|
61
|
+
sdkVersion: "4.12.0-rc.34",
|
|
62
|
+
genVersion: "2.918.3",
|
|
63
|
+
userAgent: "speakeasy-sdk/typescript 4.12.0-rc.34 2.918.3 2.0 @orq-ai/node",
|
|
64
64
|
} as const;
|
|
@@ -45,8 +45,10 @@ export class HTTPClient {
|
|
|
45
45
|
private requestHooks: BeforeRequestHook[] = [];
|
|
46
46
|
private requestErrorHooks: RequestErrorHook[] = [];
|
|
47
47
|
private responseHooks: ResponseHook[] = [];
|
|
48
|
+
private options: HTTPClientOptions;
|
|
48
49
|
|
|
49
|
-
constructor(
|
|
50
|
+
constructor(options: HTTPClientOptions = {}) {
|
|
51
|
+
this.options = options;
|
|
50
52
|
this.fetcher = options.fetcher || DEFAULT_FETCHER;
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -13,17 +13,22 @@ type OAuth2PasswordFlow = {
|
|
|
13
13
|
tokenURL: string;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
Incomplete
|
|
18
|
-
UnrecognisedSecurityType
|
|
19
|
-
}
|
|
16
|
+
export const SecurityErrorCode = {
|
|
17
|
+
Incomplete: "incomplete",
|
|
18
|
+
UnrecognisedSecurityType: "unrecognized_security_type",
|
|
19
|
+
} as const;
|
|
20
|
+
export type SecurityErrorCode =
|
|
21
|
+
(typeof SecurityErrorCode)[keyof typeof SecurityErrorCode];
|
|
20
22
|
|
|
21
23
|
export class SecurityError extends Error {
|
|
24
|
+
public code: SecurityErrorCode;
|
|
25
|
+
|
|
22
26
|
constructor(
|
|
23
|
-
|
|
27
|
+
code: SecurityErrorCode,
|
|
24
28
|
message: string,
|
|
25
29
|
) {
|
|
26
30
|
super(message);
|
|
31
|
+
this.code = code;
|
|
27
32
|
this.name = "SecurityError";
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -188,6 +188,10 @@ export type Settings = {
|
|
|
188
188
|
* If all, the agent will require approval for all tools. If respect_tool, the agent will require approval for tools that have the requires_approval flag set to true. If none, the agent will not require approval for any tools.
|
|
189
189
|
*/
|
|
190
190
|
toolApprovalRequired: ToolApprovalRequired;
|
|
191
|
+
/**
|
|
192
|
+
* When enabled, this agent is exposed as a selectable target in AI Chat for users to consume.
|
|
193
|
+
*/
|
|
194
|
+
chatExposed?: boolean | undefined;
|
|
191
195
|
tools?: Array<Tools> | undefined;
|
|
192
196
|
/**
|
|
193
197
|
* Configuration for an evaluator applied to the agent
|
|
@@ -432,6 +436,7 @@ export const Settings$inboundSchema: z.ZodType<
|
|
|
432
436
|
tool_approval_required: ToolApprovalRequired$inboundSchema.default(
|
|
433
437
|
"respect_tool",
|
|
434
438
|
),
|
|
439
|
+
chat_exposed: z.boolean().optional(),
|
|
435
440
|
tools: z.array(z.lazy(() => Tools$inboundSchema)).optional(),
|
|
436
441
|
evaluators: z.array(z.lazy(() => Evaluators$inboundSchema)).optional(),
|
|
437
442
|
guardrails: z.array(z.lazy(() => Guardrails$inboundSchema)).optional(),
|
|
@@ -441,6 +446,7 @@ export const Settings$inboundSchema: z.ZodType<
|
|
|
441
446
|
"max_execution_time": "maxExecutionTime",
|
|
442
447
|
"max_cost": "maxCost",
|
|
443
448
|
"tool_approval_required": "toolApprovalRequired",
|
|
449
|
+
"chat_exposed": "chatExposed",
|
|
444
450
|
});
|
|
445
451
|
});
|
|
446
452
|
|
|
@@ -9,6 +9,7 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
10
|
import { ApiKeyOwner, ApiKeyOwner$inboundSchema } from "./apikeyowner.js";
|
|
11
11
|
import { ApiKeyStatus, ApiKeyStatus$inboundSchema } from "./apikeystatus.js";
|
|
12
|
+
import { BudgetAlert, BudgetAlert$inboundSchema } from "./budgetalert.js";
|
|
12
13
|
import { BudgetLimits, BudgetLimits$inboundSchema } from "./budgetlimits.js";
|
|
13
14
|
import { BudgetMatch, BudgetMatch$inboundSchema } from "./budgetmatch.js";
|
|
14
15
|
import { BudgetScope, BudgetScope$inboundSchema } from "./budgetscope.js";
|
|
@@ -84,6 +85,10 @@ export type ApiKeyBudget = {
|
|
|
84
85
|
* has not been spent against in the current period.
|
|
85
86
|
*/
|
|
86
87
|
usage?: BudgetUsage | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Threshold notifications. Absent when the budget has none.
|
|
90
|
+
*/
|
|
91
|
+
alerts?: Array<BudgetAlert> | undefined;
|
|
87
92
|
};
|
|
88
93
|
|
|
89
94
|
/**
|
|
@@ -210,6 +215,7 @@ export const ApiKeyBudget$inboundSchema: z.ZodType<
|
|
|
210
215
|
updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
211
216
|
.optional(),
|
|
212
217
|
usage: BudgetUsage$inboundSchema.optional(),
|
|
218
|
+
alerts: z.array(BudgetAlert$inboundSchema).optional(),
|
|
213
219
|
}).transform((v) => {
|
|
214
220
|
return remap$(v, {
|
|
215
221
|
"budget_id": "budgetId",
|
|
@@ -7,6 +7,7 @@ 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 { BudgetAlert, BudgetAlert$inboundSchema } from "./budgetalert.js";
|
|
10
11
|
import { BudgetLimits, BudgetLimits$inboundSchema } from "./budgetlimits.js";
|
|
11
12
|
import { BudgetMatch, BudgetMatch$inboundSchema } from "./budgetmatch.js";
|
|
12
13
|
import { BudgetScope, BudgetScope$inboundSchema } from "./budgetscope.js";
|
|
@@ -71,6 +72,10 @@ export type Budget = {
|
|
|
71
72
|
* has not been spent against in the current period.
|
|
72
73
|
*/
|
|
73
74
|
usage?: BudgetUsage | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Threshold notifications. Absent when the budget has none.
|
|
77
|
+
*/
|
|
78
|
+
alerts?: Array<BudgetAlert> | undefined;
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
/** @internal */
|
|
@@ -92,6 +97,7 @@ export const Budget$inboundSchema: z.ZodType<Budget, z.ZodTypeDef, unknown> = z
|
|
|
92
97
|
new Date(v)
|
|
93
98
|
).optional(),
|
|
94
99
|
usage: BudgetUsage$inboundSchema.optional(),
|
|
100
|
+
alerts: z.array(BudgetAlert$inboundSchema).optional(),
|
|
95
101
|
}).transform((v) => {
|
|
96
102
|
return remap$(v, {
|
|
97
103
|
"budget_id": "budgetId",
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
BudgetAlertDimension,
|
|
12
|
+
BudgetAlertDimension$inboundSchema,
|
|
13
|
+
BudgetAlertDimension$outboundSchema,
|
|
14
|
+
} from "./budgetalertdimension.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Notifies every listed notifier once current-period consumption on
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* `dimension` reaches `threshold_percent` of the matching limit. Each alert
|
|
21
|
+
* fires at most once per period, re-arming on rollover or a limit change.
|
|
22
|
+
* The dimension must have a limit set, or the write is rejected.
|
|
23
|
+
*/
|
|
24
|
+
export type BudgetAlert = {
|
|
25
|
+
/**
|
|
26
|
+
* Assigned by ORQ. Supply an existing id to edit that alert in place.
|
|
27
|
+
*/
|
|
28
|
+
id?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Percentage of the dimension's limit at which the alert fires, 1–100.
|
|
31
|
+
*/
|
|
32
|
+
thresholdPercent: number;
|
|
33
|
+
/**
|
|
34
|
+
* Must be workspace-scoped; project-scoped notifiers are rejected.
|
|
35
|
+
*/
|
|
36
|
+
notifierIds: Array<string>;
|
|
37
|
+
dimension?: BudgetAlertDimension | undefined;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const BudgetAlert$inboundSchema: z.ZodType<
|
|
42
|
+
BudgetAlert,
|
|
43
|
+
z.ZodTypeDef,
|
|
44
|
+
unknown
|
|
45
|
+
> = z.object({
|
|
46
|
+
id: z.string().optional(),
|
|
47
|
+
threshold_percent: z.number().int(),
|
|
48
|
+
notifier_ids: z.array(z.string()),
|
|
49
|
+
dimension: BudgetAlertDimension$inboundSchema.optional(),
|
|
50
|
+
}).transform((v) => {
|
|
51
|
+
return remap$(v, {
|
|
52
|
+
"threshold_percent": "thresholdPercent",
|
|
53
|
+
"notifier_ids": "notifierIds",
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
/** @internal */
|
|
57
|
+
export type BudgetAlert$Outbound = {
|
|
58
|
+
id?: string | undefined;
|
|
59
|
+
threshold_percent: number;
|
|
60
|
+
notifier_ids: Array<string>;
|
|
61
|
+
dimension?: string | undefined;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** @internal */
|
|
65
|
+
export const BudgetAlert$outboundSchema: z.ZodType<
|
|
66
|
+
BudgetAlert$Outbound,
|
|
67
|
+
z.ZodTypeDef,
|
|
68
|
+
BudgetAlert
|
|
69
|
+
> = z.object({
|
|
70
|
+
id: z.string().optional(),
|
|
71
|
+
thresholdPercent: z.number().int(),
|
|
72
|
+
notifierIds: z.array(z.string()),
|
|
73
|
+
dimension: BudgetAlertDimension$outboundSchema.optional(),
|
|
74
|
+
}).transform((v) => {
|
|
75
|
+
return remap$(v, {
|
|
76
|
+
thresholdPercent: "threshold_percent",
|
|
77
|
+
notifierIds: "notifier_ids",
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export function budgetAlertToJSON(budgetAlert: BudgetAlert): string {
|
|
82
|
+
return JSON.stringify(BudgetAlert$outboundSchema.parse(budgetAlert));
|
|
83
|
+
}
|
|
84
|
+
export function budgetAlertFromJSON(
|
|
85
|
+
jsonString: string,
|
|
86
|
+
): SafeParseResult<BudgetAlert, SDKValidationError> {
|
|
87
|
+
return safeParse(
|
|
88
|
+
jsonString,
|
|
89
|
+
(x) => BudgetAlert$inboundSchema.parse(JSON.parse(x)),
|
|
90
|
+
`Failed to parse 'BudgetAlert' from JSON`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export const BudgetAlertDimension = {
|
|
9
|
+
BudgetAlertDimensionUnspecified: "BUDGET_ALERT_DIMENSION_UNSPECIFIED",
|
|
10
|
+
BudgetAlertDimensionCost: "BUDGET_ALERT_DIMENSION_COST",
|
|
11
|
+
BudgetAlertDimensionTokens: "BUDGET_ALERT_DIMENSION_TOKENS",
|
|
12
|
+
} as const;
|
|
13
|
+
export type BudgetAlertDimension = ClosedEnum<typeof BudgetAlertDimension>;
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const BudgetAlertDimension$inboundSchema: z.ZodNativeEnum<
|
|
17
|
+
typeof BudgetAlertDimension
|
|
18
|
+
> = z.nativeEnum(BudgetAlertDimension);
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const BudgetAlertDimension$outboundSchema: z.ZodNativeEnum<
|
|
21
|
+
typeof BudgetAlertDimension
|
|
22
|
+
> = BudgetAlertDimension$inboundSchema;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type Config = {
|
|
12
|
+
allowFork: boolean;
|
|
13
|
+
allowVersionPin: boolean;
|
|
14
|
+
autoGrantNewProjects: boolean;
|
|
15
|
+
mode: string;
|
|
16
|
+
projectIds?: Array<string> | null | undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const Config$inboundSchema: z.ZodType<Config, z.ZodTypeDef, unknown> = z
|
|
21
|
+
.object({
|
|
22
|
+
allow_fork: z.boolean(),
|
|
23
|
+
allow_version_pin: z.boolean(),
|
|
24
|
+
auto_grant_new_projects: z.boolean(),
|
|
25
|
+
mode: z.string(),
|
|
26
|
+
project_ids: z.nullable(z.array(z.string())).optional(),
|
|
27
|
+
}).transform((v) => {
|
|
28
|
+
return remap$(v, {
|
|
29
|
+
"allow_fork": "allowFork",
|
|
30
|
+
"allow_version_pin": "allowVersionPin",
|
|
31
|
+
"auto_grant_new_projects": "autoGrantNewProjects",
|
|
32
|
+
"project_ids": "projectIds",
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export function configFromJSON(
|
|
37
|
+
jsonString: string,
|
|
38
|
+
): SafeParseResult<Config, SDKValidationError> {
|
|
39
|
+
return safeParse(
|
|
40
|
+
jsonString,
|
|
41
|
+
(x) => Config$inboundSchema.parse(JSON.parse(x)),
|
|
42
|
+
`Failed to parse 'Config' from JSON`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import {
|
|
8
|
+
BudgetAlert,
|
|
9
|
+
BudgetAlert$Outbound,
|
|
10
|
+
BudgetAlert$outboundSchema,
|
|
11
|
+
} from "./budgetalert.js";
|
|
7
12
|
import {
|
|
8
13
|
BudgetLimits,
|
|
9
14
|
BudgetLimits$Outbound,
|
|
@@ -68,6 +73,13 @@ export type CreateBudgetRequest = {
|
|
|
68
73
|
* the value MUST be in the future; the handler rejects past values.
|
|
69
74
|
*/
|
|
70
75
|
expiresAt?: Date | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Optional threshold notifications. Ids are assigned by the server, so
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* `alerts[].id` must be omitted here; supplying one is rejected.
|
|
81
|
+
*/
|
|
82
|
+
alerts?: Array<BudgetAlert> | undefined;
|
|
71
83
|
};
|
|
72
84
|
|
|
73
85
|
/** @internal */
|
|
@@ -78,6 +90,7 @@ export type CreateBudgetRequest$Outbound = {
|
|
|
78
90
|
rate_limit?: RateLimit$Outbound | undefined;
|
|
79
91
|
is_active?: boolean | undefined;
|
|
80
92
|
expires_at?: string | undefined;
|
|
93
|
+
alerts?: Array<BudgetAlert$Outbound> | undefined;
|
|
81
94
|
};
|
|
82
95
|
|
|
83
96
|
/** @internal */
|
|
@@ -92,6 +105,7 @@ export const CreateBudgetRequest$outboundSchema: z.ZodType<
|
|
|
92
105
|
rateLimit: RateLimit$outboundSchema.optional(),
|
|
93
106
|
isActive: z.boolean().optional(),
|
|
94
107
|
expiresAt: z.date().transform(v => v.toISOString()).optional(),
|
|
108
|
+
alerts: z.array(BudgetAlert$outboundSchema).optional(),
|
|
95
109
|
}).transform((v) => {
|
|
96
110
|
return remap$(v, {
|
|
97
111
|
rateLimit: "rate_limit",
|