@orq-ai/node 4.7.5 → 4.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/funcs/filesCreate.js +3 -2
  2. package/funcs/filesCreate.js.map +1 -1
  3. package/funcs/routerAudioTranscriptionsCreate.js +3 -2
  4. package/funcs/routerAudioTranscriptionsCreate.js.map +1 -1
  5. package/funcs/routerAudioTranslationsCreate.js +3 -2
  6. package/funcs/routerAudioTranslationsCreate.js.map +1 -1
  7. package/jsr.json +1 -1
  8. package/lib/config.d.ts +3 -3
  9. package/lib/config.js +3 -3
  10. package/lib/config.js.map +1 -1
  11. package/lib/encodings.d.ts +1 -0
  12. package/lib/encodings.d.ts.map +1 -1
  13. package/lib/encodings.js +7 -0
  14. package/lib/encodings.js.map +1 -1
  15. package/models/components/reasoningpart.js +1 -1
  16. package/models/operations/createcontact.js +1 -1
  17. package/models/operations/createdataset.js +1 -1
  18. package/models/operations/createdatasetitem.js +4 -4
  19. package/models/operations/createdatasource.js +1 -1
  20. package/models/operations/createeval.js +16 -16
  21. package/models/operations/createidentity.js +1 -1
  22. package/models/operations/createtool.js +6 -6
  23. package/models/operations/getalltools.js +6 -6
  24. package/models/operations/getevals.js +16 -16
  25. package/models/operations/getv2humanevals.js +6 -6
  26. package/models/operations/getv2humanevalsets.js +2 -2
  27. package/models/operations/getv2humanevalsetsid.js +2 -2
  28. package/models/operations/getv2humanevalsid.js +6 -6
  29. package/models/operations/listdatasetdatapoints.js +4 -4
  30. package/models/operations/listdatasets.js +1 -1
  31. package/models/operations/listdatasources.js +1 -1
  32. package/models/operations/listidentities.js +1 -1
  33. package/models/operations/patchv2humanevalsetsid.js +2 -2
  34. package/models/operations/patchv2humanevalsid.js +12 -12
  35. package/models/operations/postv2feedbackevaluation.js +3 -3
  36. package/models/operations/postv2humanevals.js +12 -12
  37. package/models/operations/postv2humanevalsets.js +2 -2
  38. package/models/operations/retrievedatapoint.js +4 -4
  39. package/models/operations/retrievedataset.js +1 -1
  40. package/models/operations/retrievedatasource.js +1 -1
  41. package/models/operations/retrieveidentity.js +1 -1
  42. package/models/operations/retrievetool.js +6 -6
  43. package/models/operations/runagent.js +1 -1
  44. package/models/operations/streamrunagent.js +1 -1
  45. package/models/operations/updatedatapoint.js +4 -4
  46. package/models/operations/updatedataset.js +1 -1
  47. package/models/operations/updatedatasource.js +1 -1
  48. package/models/operations/updateeval.js +16 -16
  49. package/models/operations/updateidentity.js +1 -1
  50. package/models/operations/updatetool.js +7 -7
  51. package/package.json +1 -1
  52. package/packages/orq-rc/examples/{postV2Feedback.example.ts → postV2FeedbackEvaluationRemove.example.ts} +2 -4
  53. package/packages/orq-rc/src/funcs/agentsCreate.ts +2 -2
  54. package/packages/orq-rc/src/funcs/{evaluatorsGetV2EvaluatorsIdVersions.ts → evalsGetV2EvaluatorsIdVersions.ts} +1 -1
  55. package/packages/orq-rc/src/funcs/{postV2Feedback.ts → feedbackPostV2Feedback.ts} +5 -5
  56. package/packages/orq-rc/src/funcs/{postV2FeedbackRemove.ts → feedbackPostV2FeedbackRemove.ts} +1 -1
  57. package/packages/orq-rc/src/funcs/filesCreate.ts +4 -3
  58. package/packages/orq-rc/src/funcs/{postV2HumanEvals.ts → guardrailRulesCreate.ts} +20 -27
  59. package/packages/orq-rc/src/funcs/guardrailRulesDelete.ts +170 -0
  60. package/packages/orq-rc/src/funcs/guardrailRulesList.ts +170 -0
  61. package/packages/orq-rc/src/funcs/guardrailRulesRetrieve.ts +168 -0
  62. package/packages/orq-rc/src/funcs/guardrailRulesUpdate.ts +170 -0
  63. package/packages/orq-rc/src/funcs/knowledgeCreateChunks.ts +4 -4
  64. package/packages/orq-rc/src/funcs/policiesCreate.ts +160 -0
  65. package/packages/orq-rc/src/funcs/policiesDelete.ts +166 -0
  66. package/packages/orq-rc/src/funcs/{modelsList.ts → policiesList.ts} +17 -14
  67. package/packages/orq-rc/src/funcs/{getV2HumanEvalsId.ts → policiesRetrieve.ts} +19 -22
  68. package/packages/orq-rc/src/funcs/{patchV2HumanEvalsId.ts → policiesUpdate.ts} +20 -24
  69. package/packages/orq-rc/src/funcs/routerAudioTranscriptionsCreate.ts +4 -3
  70. package/packages/orq-rc/src/funcs/routerAudioTranslationsCreate.ts +4 -3
  71. package/packages/orq-rc/src/funcs/routingRulesCreate.ts +161 -0
  72. package/packages/orq-rc/src/funcs/routingRulesDelete.ts +166 -0
  73. package/packages/orq-rc/src/funcs/{getV2HumanEvals.ts → routingRulesList.ts} +22 -23
  74. package/packages/orq-rc/src/funcs/{deleteV2HumanEvalsId.ts → routingRulesRetrieve.ts} +20 -24
  75. package/packages/orq-rc/src/funcs/routingRulesUpdate.ts +166 -0
  76. package/packages/orq-rc/src/lib/config.ts +3 -3
  77. package/packages/orq-rc/src/lib/encodings.ts +9 -0
  78. package/packages/orq-rc/src/models/components/agentstartedstreamingevent.ts +9 -6
  79. package/packages/orq-rc/src/models/components/budgetlimit.ts +83 -0
  80. package/packages/orq-rc/src/models/components/evaluatorref.ts +89 -0
  81. package/packages/orq-rc/src/models/components/expression.ts +51 -0
  82. package/packages/orq-rc/src/models/components/guardrailref.ts +75 -0
  83. package/packages/orq-rc/src/models/components/guardrailruledocument.ts +66 -0
  84. package/packages/orq-rc/src/models/components/index.ts +13 -0
  85. package/packages/orq-rc/src/models/components/limits.ts +70 -0
  86. package/packages/orq-rc/src/models/components/modelref.ts +64 -0
  87. package/packages/orq-rc/src/models/components/modelsconfig.ts +73 -0
  88. package/packages/orq-rc/src/models/components/policydocument.ts +76 -0
  89. package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
  90. package/packages/orq-rc/src/models/components/requestlimit.ts +69 -0
  91. package/packages/orq-rc/src/models/components/retryconfig.ts +60 -0
  92. package/packages/orq-rc/src/models/components/routingruledocument.ts +67 -0
  93. package/packages/orq-rc/src/models/components/tokenlimit.ts +69 -0
  94. package/packages/orq-rc/src/models/errors/index.ts +0 -5
  95. package/packages/orq-rc/src/models/errors/postv2feedback.ts +8 -8
  96. package/packages/orq-rc/src/models/operations/createagentrequest.ts +0 -3
  97. package/packages/orq-rc/src/models/operations/createchunk.ts +7 -7
  98. package/packages/orq-rc/src/models/operations/createcontact.ts +1 -1
  99. package/packages/orq-rc/src/models/operations/createdataset.ts +1 -1
  100. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +4 -4
  101. package/packages/orq-rc/src/models/operations/createdatasource.ts +1 -1
  102. package/packages/orq-rc/src/models/operations/createeval.ts +970 -150
  103. package/packages/orq-rc/src/models/operations/createidentity.ts +1 -1
  104. package/packages/orq-rc/src/models/operations/createknowledge.ts +17 -19
  105. package/packages/orq-rc/src/models/operations/createprompt.ts +1 -0
  106. package/packages/orq-rc/src/models/operations/createresponse.ts +11 -11
  107. package/packages/orq-rc/src/models/operations/createtool.ts +6 -21
  108. package/packages/orq-rc/src/models/operations/deploymentinvoke.ts +1 -0
  109. package/packages/orq-rc/src/models/operations/deployments.ts +1 -0
  110. package/packages/orq-rc/src/models/operations/deploymentstream.ts +1 -0
  111. package/packages/orq-rc/src/models/operations/getallprompts.ts +1 -0
  112. package/packages/orq-rc/src/models/operations/getalltools.ts +6 -21
  113. package/packages/orq-rc/src/models/operations/getevals.ts +447 -16
  114. package/packages/orq-rc/src/models/operations/getoneprompt.ts +1 -0
  115. package/packages/orq-rc/src/models/operations/getpromptversion.ts +1 -0
  116. package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
  117. package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
  118. package/packages/orq-rc/src/models/operations/guardrailrulecreate.ts +124 -0
  119. package/packages/orq-rc/src/models/operations/guardrailruledelete.ts +39 -0
  120. package/packages/orq-rc/src/models/operations/guardrailruleget.ts +102 -0
  121. package/packages/orq-rc/src/models/operations/guardrailrulelist.ts +94 -0
  122. package/packages/orq-rc/src/models/operations/guardrailruleupdate.ts +153 -0
  123. package/packages/orq-rc/src/models/operations/index.ts +15 -6
  124. package/packages/orq-rc/src/models/operations/listagents.ts +0 -3
  125. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +4 -4
  126. package/packages/orq-rc/src/models/operations/listdatasets.ts +1 -1
  127. package/packages/orq-rc/src/models/operations/listdatasources.ts +1 -1
  128. package/packages/orq-rc/src/models/operations/listidentities.ts +1 -1
  129. package/packages/orq-rc/src/models/operations/listpromptversions.ts +1 -0
  130. package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  131. package/packages/orq-rc/src/models/operations/policycreate.ts +138 -0
  132. package/packages/orq-rc/src/models/operations/policydelete.ts +39 -0
  133. package/packages/orq-rc/src/models/operations/policyget.ts +110 -0
  134. package/packages/orq-rc/src/models/operations/policylist.ts +94 -0
  135. package/packages/orq-rc/src/models/operations/policyupdate.ts +167 -0
  136. package/packages/orq-rc/src/models/operations/postv2agentsa2a.ts +0 -3
  137. package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +3 -3
  138. package/packages/orq-rc/src/models/operations/postv2feedbackremove.ts +8 -8
  139. package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
  140. package/packages/orq-rc/src/models/operations/retrieveagentrequest.ts +0 -3
  141. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +4 -4
  142. package/packages/orq-rc/src/models/operations/retrievedataset.ts +1 -1
  143. package/packages/orq-rc/src/models/operations/retrievedatasource.ts +1 -1
  144. package/packages/orq-rc/src/models/operations/retrieveidentity.ts +1 -1
  145. package/packages/orq-rc/src/models/operations/retrievetool.ts +6 -21
  146. package/packages/orq-rc/src/models/operations/routingrulecreate.ts +124 -0
  147. package/packages/orq-rc/src/models/operations/routingruledelete.ts +39 -0
  148. package/packages/orq-rc/src/models/operations/routingruleget.ts +102 -0
  149. package/packages/orq-rc/src/models/operations/routingrulelist.ts +94 -0
  150. package/packages/orq-rc/src/models/operations/routingruleupdate.ts +154 -0
  151. package/packages/orq-rc/src/models/operations/runagent.ts +1 -1
  152. package/packages/orq-rc/src/models/operations/streamrunagent.ts +1 -1
  153. package/packages/orq-rc/src/models/operations/updateagent.ts +0 -3
  154. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +4 -4
  155. package/packages/orq-rc/src/models/operations/updatedataset.ts +1 -1
  156. package/packages/orq-rc/src/models/operations/updatedatasource.ts +1 -1
  157. package/packages/orq-rc/src/models/operations/updateeval.ts +646 -16
  158. package/packages/orq-rc/src/models/operations/updateidentity.ts +1 -1
  159. package/packages/orq-rc/src/models/operations/updateprompt.ts +1 -0
  160. package/packages/orq-rc/src/models/operations/updatetool.ts +7 -22
  161. package/packages/orq-rc/src/sdk/evals.ts +18 -0
  162. package/packages/orq-rc/src/sdk/feedback.ts +33 -0
  163. package/packages/orq-rc/src/sdk/guardrailrules.ts +99 -0
  164. package/packages/orq-rc/src/sdk/knowledge.ts +1 -1
  165. package/packages/orq-rc/src/sdk/policies.ts +99 -0
  166. package/packages/orq-rc/src/sdk/routingrules.ts +99 -0
  167. package/packages/orq-rc/src/sdk/sdk.ts +22 -94
  168. package/src/funcs/filesCreate.ts +4 -3
  169. package/src/funcs/routerAudioTranscriptionsCreate.ts +4 -3
  170. package/src/funcs/routerAudioTranslationsCreate.ts +4 -3
  171. package/src/lib/config.ts +3 -3
  172. package/src/lib/encodings.ts +9 -0
  173. package/src/models/components/reasoningpart.ts +1 -1
  174. package/src/models/operations/createcontact.ts +1 -1
  175. package/src/models/operations/createdataset.ts +1 -1
  176. package/src/models/operations/createdatasetitem.ts +4 -4
  177. package/src/models/operations/createdatasource.ts +1 -1
  178. package/src/models/operations/createeval.ts +16 -16
  179. package/src/models/operations/createidentity.ts +1 -1
  180. package/src/models/operations/createtool.ts +6 -6
  181. package/src/models/operations/getalltools.ts +6 -6
  182. package/src/models/operations/getevals.ts +16 -16
  183. package/src/models/operations/getv2humanevals.ts +6 -6
  184. package/src/models/operations/getv2humanevalsets.ts +2 -2
  185. package/src/models/operations/getv2humanevalsetsid.ts +2 -2
  186. package/src/models/operations/getv2humanevalsid.ts +6 -6
  187. package/src/models/operations/listdatasetdatapoints.ts +4 -4
  188. package/src/models/operations/listdatasets.ts +1 -1
  189. package/src/models/operations/listdatasources.ts +1 -1
  190. package/src/models/operations/listidentities.ts +1 -1
  191. package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  192. package/src/models/operations/patchv2humanevalsid.ts +12 -12
  193. package/src/models/operations/postv2feedbackevaluation.ts +3 -3
  194. package/src/models/operations/postv2humanevals.ts +12 -12
  195. package/src/models/operations/postv2humanevalsets.ts +2 -2
  196. package/src/models/operations/retrievedatapoint.ts +4 -4
  197. package/src/models/operations/retrievedataset.ts +1 -1
  198. package/src/models/operations/retrievedatasource.ts +1 -1
  199. package/src/models/operations/retrieveidentity.ts +1 -1
  200. package/src/models/operations/retrievetool.ts +6 -6
  201. package/src/models/operations/runagent.ts +1 -1
  202. package/src/models/operations/streamrunagent.ts +1 -1
  203. package/src/models/operations/updatedatapoint.ts +4 -4
  204. package/src/models/operations/updatedataset.ts +1 -1
  205. package/src/models/operations/updatedatasource.ts +1 -1
  206. package/src/models/operations/updateeval.ts +16 -16
  207. package/src/models/operations/updateidentity.ts +1 -1
  208. package/src/models/operations/updatetool.ts +7 -7
  209. package/packages/orq-rc/src/models/errors/deletev2humanevalsid.ts +0 -51
  210. package/packages/orq-rc/src/models/errors/getv2humanevals.ts +0 -51
  211. package/packages/orq-rc/src/models/errors/getv2humanevalsid.ts +0 -51
  212. package/packages/orq-rc/src/models/errors/patchv2humanevalsid.ts +0 -51
  213. package/packages/orq-rc/src/models/errors/postv2humanevals.ts +0 -51
  214. package/packages/orq-rc/src/models/operations/deletev2humanevalsid.ts +0 -67
  215. package/packages/orq-rc/src/models/operations/getv2humanevals.ts +0 -696
  216. package/packages/orq-rc/src/models/operations/getv2humanevalsid.ts +0 -707
  217. package/packages/orq-rc/src/models/operations/listmodels.ts +0 -169
  218. package/packages/orq-rc/src/models/operations/patchv2humanevalsid.ts +0 -1362
  219. package/packages/orq-rc/src/models/operations/postv2humanevals.ts +0 -1193
  220. package/packages/orq-rc/src/sdk/evaluators.ts +0 -27
  221. package/packages/orq-rc/src/sdk/models.ts +0 -27
@@ -0,0 +1,170 @@
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 { encodeSimple } from "../lib/encodings.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 { OrqError } from "../models/errors/orqerror.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.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
+ * Delete guardrail rule
30
+ *
31
+ * @remarks
32
+ * Deletes an existing guardrail rule by ID.
33
+ */
34
+ export function guardrailRulesDelete(
35
+ client: OrqCore,
36
+ request: operations.GuardrailRuleDeleteRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ void,
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: operations.GuardrailRuleDeleteRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ void,
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) =>
81
+ operations.GuardrailRuleDeleteRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = null;
89
+
90
+ const pathParams = {
91
+ guardrail_rule_id: encodeSimple(
92
+ "guardrail_rule_id",
93
+ payload.guardrail_rule_id,
94
+ { explode: false, charEncoding: "percent" },
95
+ ),
96
+ };
97
+ const path = pathToFunc("/v2/guardrail-rules/{guardrail_rule_id}")(
98
+ pathParams,
99
+ );
100
+
101
+ const headers = new Headers(compactMap({
102
+ Accept: "*/*",
103
+ }));
104
+
105
+ const secConfig = await extractSecurity(client._options.apiKey);
106
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "GuardrailRuleDelete",
113
+ oAuth2Scopes: null,
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.apiKey,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "DELETE",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["404", "4XX", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const [result] = await M.match<
151
+ void,
152
+ | OrqError
153
+ | ResponseValidationError
154
+ | ConnectionError
155
+ | RequestAbortedError
156
+ | RequestTimeoutError
157
+ | InvalidRequestError
158
+ | UnexpectedClientError
159
+ | SDKValidationError
160
+ >(
161
+ M.nil(204, z.void()),
162
+ M.fail([404, "4XX"]),
163
+ M.fail("5XX"),
164
+ )(response, req);
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.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 * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * List guardrail rules
29
+ *
30
+ * @remarks
31
+ * Returns a paginated list of guardrail rules for the current project.
32
+ */
33
+ export function guardrailRulesList(
34
+ client: OrqCore,
35
+ request?: operations.GuardrailRuleListRequest | undefined,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.GuardrailRuleListResponseBody,
40
+ | OrqError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OrqCore,
59
+ request?: operations.GuardrailRuleListRequest | undefined,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.GuardrailRuleListResponseBody,
65
+ | OrqError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) =>
80
+ operations.GuardrailRuleListRequest$outboundSchema.optional().parse(
81
+ value,
82
+ ),
83
+ "Input validation failed",
84
+ );
85
+ if (!parsed.ok) {
86
+ return [parsed, { status: "invalid" }];
87
+ }
88
+ const payload = parsed.value;
89
+ const body = null;
90
+
91
+ const path = pathToFunc("/v2/guardrail-rules")();
92
+
93
+ const query = encodeFormQuery({
94
+ "ending_before": payload?.ending_before,
95
+ "limit": payload?.limit,
96
+ "project_id": payload?.project_id,
97
+ "starting_after": payload?.starting_after,
98
+ }, { explode: false });
99
+
100
+ const headers = new Headers(compactMap({
101
+ Accept: "application/json",
102
+ }));
103
+
104
+ const secConfig = await extractSecurity(client._options.apiKey);
105
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
106
+ const requestSecurity = resolveGlobalSecurity(securityInput);
107
+
108
+ const context = {
109
+ options: client._options,
110
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
111
+ operationID: "GuardrailRuleList",
112
+ oAuth2Scopes: null,
113
+
114
+ resolvedSecurity: requestSecurity,
115
+
116
+ securitySource: client._options.apiKey,
117
+ retryConfig: options?.retries
118
+ || client._options.retryConfig
119
+ || { strategy: "none" },
120
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
121
+ };
122
+
123
+ const requestRes = client._createRequest(context, {
124
+ security: requestSecurity,
125
+ method: "GET",
126
+ baseURL: options?.serverURL,
127
+ path: path,
128
+ headers: headers,
129
+ query: query,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["4XX", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const [result] = await M.match<
151
+ operations.GuardrailRuleListResponseBody,
152
+ | OrqError
153
+ | ResponseValidationError
154
+ | ConnectionError
155
+ | RequestAbortedError
156
+ | RequestTimeoutError
157
+ | InvalidRequestError
158
+ | UnexpectedClientError
159
+ | SDKValidationError
160
+ >(
161
+ M.json(200, operations.GuardrailRuleListResponseBody$inboundSchema),
162
+ M.fail("4XX"),
163
+ M.fail("5XX"),
164
+ )(response, req);
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }
@@ -0,0 +1,168 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.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 * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Get guardrail rule
29
+ *
30
+ * @remarks
31
+ * Retrieves the details of an existing guardrail rule by ID.
32
+ */
33
+ export function guardrailRulesRetrieve(
34
+ client: OrqCore,
35
+ request: operations.GuardrailRuleGetRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.GuardrailRuleGetResponseBody,
40
+ | OrqError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OrqCore,
59
+ request: operations.GuardrailRuleGetRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.GuardrailRuleGetResponseBody,
65
+ | OrqError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) => operations.GuardrailRuleGetRequest$outboundSchema.parse(value),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed.ok) {
83
+ return [parsed, { status: "invalid" }];
84
+ }
85
+ const payload = parsed.value;
86
+ const body = null;
87
+
88
+ const pathParams = {
89
+ guardrail_rule_id: encodeSimple(
90
+ "guardrail_rule_id",
91
+ payload.guardrail_rule_id,
92
+ { explode: false, charEncoding: "percent" },
93
+ ),
94
+ };
95
+ const path = pathToFunc("/v2/guardrail-rules/{guardrail_rule_id}")(
96
+ pathParams,
97
+ );
98
+
99
+ const headers = new Headers(compactMap({
100
+ Accept: "application/json",
101
+ }));
102
+
103
+ const secConfig = await extractSecurity(client._options.apiKey);
104
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
105
+ const requestSecurity = resolveGlobalSecurity(securityInput);
106
+
107
+ const context = {
108
+ options: client._options,
109
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
110
+ operationID: "GuardrailRuleGet",
111
+ oAuth2Scopes: null,
112
+
113
+ resolvedSecurity: requestSecurity,
114
+
115
+ securitySource: client._options.apiKey,
116
+ retryConfig: options?.retries
117
+ || client._options.retryConfig
118
+ || { strategy: "none" },
119
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
120
+ };
121
+
122
+ const requestRes = client._createRequest(context, {
123
+ security: requestSecurity,
124
+ method: "GET",
125
+ baseURL: options?.serverURL,
126
+ path: path,
127
+ headers: headers,
128
+ body: body,
129
+ userAgent: client._options.userAgent,
130
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
131
+ }, options);
132
+ if (!requestRes.ok) {
133
+ return [requestRes, { status: "invalid" }];
134
+ }
135
+ const req = requestRes.value;
136
+
137
+ const doResult = await client._do(req, {
138
+ context,
139
+ errorCodes: ["404", "4XX", "5XX"],
140
+ retryConfig: context.retryConfig,
141
+ retryCodes: context.retryCodes,
142
+ });
143
+ if (!doResult.ok) {
144
+ return [doResult, { status: "request-error", request: req }];
145
+ }
146
+ const response = doResult.value;
147
+
148
+ const [result] = await M.match<
149
+ operations.GuardrailRuleGetResponseBody,
150
+ | OrqError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, operations.GuardrailRuleGetResponseBody$inboundSchema),
160
+ M.fail([404, "4XX"]),
161
+ M.fail("5XX"),
162
+ )(response, req);
163
+ if (!result.ok) {
164
+ return [result, { status: "complete", request: req, response }];
165
+ }
166
+
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.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 * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Update guardrail rule
29
+ *
30
+ * @remarks
31
+ * Partially updates an existing guardrail rule. Only provided fields are updated.
32
+ */
33
+ export function guardrailRulesUpdate(
34
+ client: OrqCore,
35
+ request: operations.GuardrailRuleUpdateRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.GuardrailRuleUpdateResponseBody,
40
+ | OrqError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: OrqCore,
59
+ request: operations.GuardrailRuleUpdateRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.GuardrailRuleUpdateResponseBody,
65
+ | OrqError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) =>
80
+ operations.GuardrailRuleUpdateRequest$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.RequestBody, { explode: true });
88
+
89
+ const pathParams = {
90
+ guardrail_rule_id: encodeSimple(
91
+ "guardrail_rule_id",
92
+ payload.guardrail_rule_id,
93
+ { explode: false, charEncoding: "percent" },
94
+ ),
95
+ };
96
+ const path = pathToFunc("/v2/guardrail-rules/{guardrail_rule_id}")(
97
+ pathParams,
98
+ );
99
+
100
+ const headers = new Headers(compactMap({
101
+ "Content-Type": "application/json",
102
+ Accept: "application/json",
103
+ }));
104
+
105
+ const secConfig = await extractSecurity(client._options.apiKey);
106
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "GuardrailRuleUpdate",
113
+ oAuth2Scopes: null,
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.apiKey,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "PATCH",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["400", "404", "4XX", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const [result] = await M.match<
151
+ operations.GuardrailRuleUpdateResponseBody,
152
+ | OrqError
153
+ | ResponseValidationError
154
+ | ConnectionError
155
+ | RequestAbortedError
156
+ | RequestTimeoutError
157
+ | InvalidRequestError
158
+ | UnexpectedClientError
159
+ | SDKValidationError
160
+ >(
161
+ M.json(200, operations.GuardrailRuleUpdateResponseBody$inboundSchema),
162
+ M.fail([400, 404, "4XX"]),
163
+ M.fail("5XX"),
164
+ )(response, req);
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }
@@ -34,7 +34,7 @@ export function knowledgeCreateChunks(
34
34
  options?: RequestOptions,
35
35
  ): APIPromise<
36
36
  Result<
37
- Array<operations.CreateChunkResponseBody>,
37
+ Array<operations.ResponseBody>,
38
38
  | OrqError
39
39
  | ResponseValidationError
40
40
  | ConnectionError
@@ -59,7 +59,7 @@ async function $do(
59
59
  ): Promise<
60
60
  [
61
61
  Result<
62
- Array<operations.CreateChunkResponseBody>,
62
+ Array<operations.ResponseBody>,
63
63
  | OrqError
64
64
  | ResponseValidationError
65
65
  | ConnectionError
@@ -148,7 +148,7 @@ async function $do(
148
148
  const response = doResult.value;
149
149
 
150
150
  const [result] = await M.match<
151
- Array<operations.CreateChunkResponseBody>,
151
+ Array<operations.ResponseBody>,
152
152
  | OrqError
153
153
  | ResponseValidationError
154
154
  | ConnectionError
@@ -158,7 +158,7 @@ async function $do(
158
158
  | UnexpectedClientError
159
159
  | SDKValidationError
160
160
  >(
161
- M.json(200, z.array(operations.CreateChunkResponseBody$inboundSchema)),
161
+ M.json(200, z.array(operations.ResponseBody$inboundSchema)),
162
162
  M.fail("4XX"),
163
163
  M.fail([500, "5XX"]),
164
164
  )(response, req);