@orq-ai/node 3.2.6 → 3.2.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.
Files changed (79) hide show
  1. package/bin/mcp-server.js +32 -32
  2. package/bin/mcp-server.js.map +17 -17
  3. package/jsr.json +1 -1
  4. package/lib/config.d.ts +3 -3
  5. package/lib/config.js +3 -3
  6. package/mcp-server/mcp-server.js +1 -1
  7. package/mcp-server/server.js +1 -1
  8. package/models/operations/bulkcreatedatapoints.js +2 -2
  9. package/models/operations/createcontact.js +2 -2
  10. package/models/operations/createdataset.js +2 -2
  11. package/models/operations/createdatasetitem.js +2 -2
  12. package/models/operations/fileget.js +2 -2
  13. package/models/operations/filelist.js +2 -2
  14. package/models/operations/fileupload.js +2 -2
  15. package/models/operations/listdatasetdatapoints.js +2 -2
  16. package/models/operations/listdatasets.js +2 -2
  17. package/models/operations/retrievedatapoint.js +2 -2
  18. package/models/operations/retrievedataset.js +2 -2
  19. package/models/operations/updatedatapoint.js +2 -2
  20. package/models/operations/updatedataset.js +2 -2
  21. package/package.json +1 -1
  22. package/packages/orq-rc/README.md +39 -1
  23. package/packages/orq-rc/docs/sdks/deployments/README.md +81 -0
  24. package/packages/orq-rc/docs/sdks/prompts/README.md +110 -110
  25. package/packages/orq-rc/jsr.json +2 -1
  26. package/packages/orq-rc/package-lock.json +2 -2
  27. package/packages/orq-rc/package.json +1 -1
  28. package/packages/orq-rc/src/funcs/datasetsList.ts +0 -1
  29. package/packages/orq-rc/src/funcs/datasetsListDatapoints.ts +0 -1
  30. package/packages/orq-rc/src/funcs/deploymentsList.ts +0 -1
  31. package/packages/orq-rc/src/funcs/deploymentsStream.ts +178 -0
  32. package/packages/orq-rc/src/funcs/filesList.ts +0 -1
  33. package/packages/orq-rc/src/funcs/promptsList.ts +1 -2
  34. package/packages/orq-rc/src/funcs/promptsListVersions.ts +0 -1
  35. package/packages/orq-rc/src/lib/config.ts +3 -3
  36. package/packages/orq-rc/src/lib/event-streams.ts +264 -0
  37. package/packages/orq-rc/src/lib/matchers.ts +4 -1
  38. package/packages/orq-rc/src/lib/security.ts +11 -3
  39. package/packages/orq-rc/src/mcp-server/mcp-server.ts +1 -1
  40. package/packages/orq-rc/src/mcp-server/server.ts +4 -2
  41. package/packages/orq-rc/src/mcp-server/tools/deploymentsStream.ts +37 -0
  42. package/packages/orq-rc/src/models/operations/bulkcreatedatapoints.ts +2 -2
  43. package/packages/orq-rc/src/models/operations/createcontact.ts +2 -2
  44. package/packages/orq-rc/src/models/operations/createdataset.ts +2 -2
  45. package/packages/orq-rc/src/models/operations/createdatasetitem.ts +2 -2
  46. package/packages/orq-rc/src/models/operations/createprompt.ts +599 -680
  47. package/packages/orq-rc/src/models/operations/deployments.ts +0 -39
  48. package/packages/orq-rc/src/models/operations/deploymentstream.ts +5960 -0
  49. package/packages/orq-rc/src/models/operations/fileget.ts +2 -2
  50. package/packages/orq-rc/src/models/operations/filelist.ts +2 -42
  51. package/packages/orq-rc/src/models/operations/fileupload.ts +2 -2
  52. package/packages/orq-rc/src/models/operations/getallprompts.ts +0 -42
  53. package/packages/orq-rc/src/models/operations/index.ts +1 -0
  54. package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +2 -46
  55. package/packages/orq-rc/src/models/operations/listdatasets.ts +2 -44
  56. package/packages/orq-rc/src/models/operations/listpromptversions.ts +0 -42
  57. package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +2 -2
  58. package/packages/orq-rc/src/models/operations/retrievedataset.ts +2 -2
  59. package/packages/orq-rc/src/models/operations/updatedatapoint.ts +2 -2
  60. package/packages/orq-rc/src/models/operations/updatedataset.ts +2 -2
  61. package/packages/orq-rc/src/models/operations/updateprompt.ts +682 -599
  62. package/packages/orq-rc/src/sdk/deployments.ts +19 -0
  63. package/packages/orq-rc/src/sdk/prompts.ts +14 -14
  64. package/src/lib/config.ts +3 -3
  65. package/src/mcp-server/mcp-server.ts +1 -1
  66. package/src/mcp-server/server.ts +1 -1
  67. package/src/models/operations/bulkcreatedatapoints.ts +2 -2
  68. package/src/models/operations/createcontact.ts +2 -2
  69. package/src/models/operations/createdataset.ts +2 -2
  70. package/src/models/operations/createdatasetitem.ts +2 -2
  71. package/src/models/operations/fileget.ts +2 -2
  72. package/src/models/operations/filelist.ts +2 -2
  73. package/src/models/operations/fileupload.ts +2 -2
  74. package/src/models/operations/listdatasetdatapoints.ts +2 -2
  75. package/src/models/operations/listdatasets.ts +2 -2
  76. package/src/models/operations/retrievedatapoint.ts +2 -2
  77. package/src/models/operations/retrievedataset.ts +2 -2
  78. package/src/models/operations/updatedatapoint.ts +2 -2
  79. package/src/models/operations/updatedataset.ts +2 -2
@@ -6,10 +6,10 @@
6
6
  ### Available Operations
7
7
 
8
8
  * [list](#list) - List all prompts
9
+ * [create](#create) - Create a prompt
9
10
  * [retrieve](#retrieve) - Retrieve a prompt
10
11
  * [update](#update) - Update a prompt
11
12
  * [delete](#delete) - Delete a prompt
12
- * [create](#create) - Create a prompt
13
13
  * [listVersions](#listversions) - List all prompt versions
14
14
  * [getVersion](#getversion) - Retrieve a prompt version
15
15
 
@@ -85,9 +85,9 @@ run();
85
85
  | --------------- | --------------- | --------------- |
86
86
  | errors.APIError | 4XX, 5XX | \*/\* |
87
87
 
88
- ## retrieve
88
+ ## create
89
89
 
90
- Retrieves a prompt object
90
+ Create a prompt
91
91
 
92
92
  ### Example Usage
93
93
 
@@ -99,8 +99,40 @@ const orq = new Orq({
99
99
  });
100
100
 
101
101
  async function run() {
102
- const result = await orq.prompts.retrieve({
103
- id: "<id>",
102
+ const result = await orq.prompts.create({
103
+ displayName: "Jed6",
104
+ promptConfig: {
105
+ messages: [
106
+ {
107
+ role: "system",
108
+ content: "<value>",
109
+ },
110
+ {
111
+ role: "system",
112
+ content: [
113
+ {
114
+ type: "image_url",
115
+ imageUrl: {
116
+ url: "https://well-worn-formation.biz",
117
+ },
118
+ },
119
+ {
120
+ type: "text",
121
+ text: "<value>",
122
+ },
123
+ {
124
+ type: "text",
125
+ text: "<value>",
126
+ },
127
+ ],
128
+ },
129
+ {
130
+ role: "assistant",
131
+ content: "<value>",
132
+ },
133
+ ],
134
+ },
135
+ path: "Customer Service/Billing/Refund",
104
136
  });
105
137
 
106
138
  // Handle the result
@@ -116,7 +148,7 @@ The standalone function version of this method:
116
148
 
117
149
  ```typescript
118
150
  import { OrqCore } from "@orq-ai/node/core.js";
119
- import { promptsRetrieve } from "@orq-ai/node/funcs/promptsRetrieve.js";
151
+ import { promptsCreate } from "@orq-ai/node/funcs/promptsCreate.js";
120
152
 
121
153
  // Use `OrqCore` for best tree-shaking performance.
122
154
  // You can create one instance of it to use across an application.
@@ -125,8 +157,40 @@ const orq = new OrqCore({
125
157
  });
126
158
 
127
159
  async function run() {
128
- const res = await promptsRetrieve(orq, {
129
- id: "<id>",
160
+ const res = await promptsCreate(orq, {
161
+ displayName: "Jed6",
162
+ promptConfig: {
163
+ messages: [
164
+ {
165
+ role: "system",
166
+ content: "<value>",
167
+ },
168
+ {
169
+ role: "system",
170
+ content: [
171
+ {
172
+ type: "image_url",
173
+ imageUrl: {
174
+ url: "https://well-worn-formation.biz",
175
+ },
176
+ },
177
+ {
178
+ type: "text",
179
+ text: "<value>",
180
+ },
181
+ {
182
+ type: "text",
183
+ text: "<value>",
184
+ },
185
+ ],
186
+ },
187
+ {
188
+ role: "assistant",
189
+ content: "<value>",
190
+ },
191
+ ],
192
+ },
193
+ path: "Customer Service/Billing/Refund",
130
194
  });
131
195
 
132
196
  if (!res.ok) {
@@ -146,14 +210,14 @@ run();
146
210
 
147
211
  | Parameter | Type | Required | Description |
148
212
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
149
- | `request` | [operations.GetOnePromptRequest](../../models/operations/getonepromptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
213
+ | `request` | [operations.CreatePromptRequestBody](../../models/operations/createpromptrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
150
214
  | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
151
215
  | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
152
216
  | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
153
217
 
154
218
  ### Response
155
219
 
156
- **Promise\<[operations.GetOnePromptResponseBody](../../models/operations/getonepromptresponsebody.md)\>**
220
+ **Promise\<[operations.CreatePromptResponseBody](../../models/operations/createpromptresponsebody.md)\>**
157
221
 
158
222
  ### Errors
159
223
 
@@ -161,9 +225,9 @@ run();
161
225
  | --------------- | --------------- | --------------- |
162
226
  | errors.APIError | 4XX, 5XX | \*/\* |
163
227
 
164
- ## update
228
+ ## retrieve
165
229
 
166
- Update a prompt
230
+ Retrieves a prompt object
167
231
 
168
232
  ### Example Usage
169
233
 
@@ -175,7 +239,7 @@ const orq = new Orq({
175
239
  });
176
240
 
177
241
  async function run() {
178
- const result = await orq.prompts.update({
242
+ const result = await orq.prompts.retrieve({
179
243
  id: "<id>",
180
244
  });
181
245
 
@@ -192,7 +256,7 @@ The standalone function version of this method:
192
256
 
193
257
  ```typescript
194
258
  import { OrqCore } from "@orq-ai/node/core.js";
195
- import { promptsUpdate } from "@orq-ai/node/funcs/promptsUpdate.js";
259
+ import { promptsRetrieve } from "@orq-ai/node/funcs/promptsRetrieve.js";
196
260
 
197
261
  // Use `OrqCore` for best tree-shaking performance.
198
262
  // You can create one instance of it to use across an application.
@@ -201,7 +265,7 @@ const orq = new OrqCore({
201
265
  });
202
266
 
203
267
  async function run() {
204
- const res = await promptsUpdate(orq, {
268
+ const res = await promptsRetrieve(orq, {
205
269
  id: "<id>",
206
270
  });
207
271
 
@@ -222,25 +286,24 @@ run();
222
286
 
223
287
  | Parameter | Type | Required | Description |
224
288
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
225
- | `request` | [operations.UpdatePromptRequest](../../models/operations/updatepromptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
289
+ | `request` | [operations.GetOnePromptRequest](../../models/operations/getonepromptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
226
290
  | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
227
291
  | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
228
292
  | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
229
293
 
230
294
  ### Response
231
295
 
232
- **Promise\<[operations.UpdatePromptResponseBody](../../models/operations/updatepromptresponsebody.md)\>**
296
+ **Promise\<[operations.GetOnePromptResponseBody](../../models/operations/getonepromptresponsebody.md)\>**
233
297
 
234
298
  ### Errors
235
299
 
236
- | Error Type | Status Code | Content Type |
237
- | ------------------------------- | ------------------------------- | ------------------------------- |
238
- | errors.UpdatePromptResponseBody | 404 | application/json |
239
- | errors.APIError | 4XX, 5XX | \*/\* |
300
+ | Error Type | Status Code | Content Type |
301
+ | --------------- | --------------- | --------------- |
302
+ | errors.APIError | 4XX, 5XX | \*/\* |
240
303
 
241
- ## delete
304
+ ## update
242
305
 
243
- Delete a prompt
306
+ Update a prompt
244
307
 
245
308
  ### Example Usage
246
309
 
@@ -252,11 +315,12 @@ const orq = new Orq({
252
315
  });
253
316
 
254
317
  async function run() {
255
- await orq.prompts.delete({
318
+ const result = await orq.prompts.update({
256
319
  id: "<id>",
257
320
  });
258
321
 
259
-
322
+ // Handle the result
323
+ console.log(result);
260
324
  }
261
325
 
262
326
  run();
@@ -268,7 +332,7 @@ The standalone function version of this method:
268
332
 
269
333
  ```typescript
270
334
  import { OrqCore } from "@orq-ai/node/core.js";
271
- import { promptsDelete } from "@orq-ai/node/funcs/promptsDelete.js";
335
+ import { promptsUpdate } from "@orq-ai/node/funcs/promptsUpdate.js";
272
336
 
273
337
  // Use `OrqCore` for best tree-shaking performance.
274
338
  // You can create one instance of it to use across an application.
@@ -277,7 +341,7 @@ const orq = new OrqCore({
277
341
  });
278
342
 
279
343
  async function run() {
280
- const res = await promptsDelete(orq, {
344
+ const res = await promptsUpdate(orq, {
281
345
  id: "<id>",
282
346
  });
283
347
 
@@ -287,7 +351,8 @@ async function run() {
287
351
 
288
352
  const { value: result } = res;
289
353
 
290
-
354
+ // Handle the result
355
+ console.log(result);
291
356
  }
292
357
 
293
358
  run();
@@ -297,24 +362,25 @@ run();
297
362
 
298
363
  | Parameter | Type | Required | Description |
299
364
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
300
- | `request` | [operations.DeletePromptRequest](../../models/operations/deletepromptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
365
+ | `request` | [operations.UpdatePromptRequest](../../models/operations/updatepromptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
301
366
  | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
302
367
  | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
303
368
  | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
304
369
 
305
370
  ### Response
306
371
 
307
- **Promise\<void\>**
372
+ **Promise\<[operations.UpdatePromptResponseBody](../../models/operations/updatepromptresponsebody.md)\>**
308
373
 
309
374
  ### Errors
310
375
 
311
- | Error Type | Status Code | Content Type |
312
- | --------------- | --------------- | --------------- |
313
- | errors.APIError | 4XX, 5XX | \*/\* |
376
+ | Error Type | Status Code | Content Type |
377
+ | ------------------------------- | ------------------------------- | ------------------------------- |
378
+ | errors.UpdatePromptResponseBody | 404 | application/json |
379
+ | errors.APIError | 4XX, 5XX | \*/\* |
314
380
 
315
- ## create
381
+ ## delete
316
382
 
317
- Create a prompt
383
+ Delete a prompt
318
384
 
319
385
  ### Example Usage
320
386
 
@@ -326,44 +392,11 @@ const orq = new Orq({
326
392
  });
327
393
 
328
394
  async function run() {
329
- const result = await orq.prompts.create({
330
- displayName: "Jed6",
331
- promptConfig: {
332
- messages: [
333
- {
334
- role: "system",
335
- content: "<value>",
336
- },
337
- {
338
- role: "system",
339
- content: [
340
- {
341
- type: "image_url",
342
- imageUrl: {
343
- url: "https://well-worn-formation.biz",
344
- },
345
- },
346
- {
347
- type: "text",
348
- text: "<value>",
349
- },
350
- {
351
- type: "text",
352
- text: "<value>",
353
- },
354
- ],
355
- },
356
- {
357
- role: "assistant",
358
- content: "<value>",
359
- },
360
- ],
361
- },
362
- path: "Customer Service/Billing/Refund",
395
+ await orq.prompts.delete({
396
+ id: "<id>",
363
397
  });
364
398
 
365
- // Handle the result
366
- console.log(result);
399
+
367
400
  }
368
401
 
369
402
  run();
@@ -375,7 +408,7 @@ The standalone function version of this method:
375
408
 
376
409
  ```typescript
377
410
  import { OrqCore } from "@orq-ai/node/core.js";
378
- import { promptsCreate } from "@orq-ai/node/funcs/promptsCreate.js";
411
+ import { promptsDelete } from "@orq-ai/node/funcs/promptsDelete.js";
379
412
 
380
413
  // Use `OrqCore` for best tree-shaking performance.
381
414
  // You can create one instance of it to use across an application.
@@ -384,40 +417,8 @@ const orq = new OrqCore({
384
417
  });
385
418
 
386
419
  async function run() {
387
- const res = await promptsCreate(orq, {
388
- displayName: "Jed6",
389
- promptConfig: {
390
- messages: [
391
- {
392
- role: "system",
393
- content: "<value>",
394
- },
395
- {
396
- role: "system",
397
- content: [
398
- {
399
- type: "image_url",
400
- imageUrl: {
401
- url: "https://well-worn-formation.biz",
402
- },
403
- },
404
- {
405
- type: "text",
406
- text: "<value>",
407
- },
408
- {
409
- type: "text",
410
- text: "<value>",
411
- },
412
- ],
413
- },
414
- {
415
- role: "assistant",
416
- content: "<value>",
417
- },
418
- ],
419
- },
420
- path: "Customer Service/Billing/Refund",
420
+ const res = await promptsDelete(orq, {
421
+ id: "<id>",
421
422
  });
422
423
 
423
424
  if (!res.ok) {
@@ -426,8 +427,7 @@ async function run() {
426
427
 
427
428
  const { value: result } = res;
428
429
 
429
- // Handle the result
430
- console.log(result);
430
+
431
431
  }
432
432
 
433
433
  run();
@@ -437,14 +437,14 @@ run();
437
437
 
438
438
  | Parameter | Type | Required | Description |
439
439
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
440
- | `request` | [operations.CreatePromptRequestBody](../../models/operations/createpromptrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
440
+ | `request` | [operations.DeletePromptRequest](../../models/operations/deletepromptrequest.md) | :heavy_check_mark: | The request object to use for the request. |
441
441
  | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
442
442
  | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
443
443
  | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
444
444
 
445
445
  ### Response
446
446
 
447
- **Promise\<[operations.CreatePromptResponseBody](../../models/operations/createpromptresponsebody.md)\>**
447
+ **Promise\<void\>**
448
448
 
449
449
  ### Errors
450
450
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@orq-ai/node",
5
- "version": "3.2.0-rc.62",
5
+ "version": "3.3.0-rc.9",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
@@ -12,6 +12,7 @@
12
12
  "./lib/http": "./src/lib/http.ts",
13
13
  "./lib/retries": "./src/lib/retries.ts",
14
14
  "./lib/sdks": "./src/lib/sdks.ts",
15
+ "./lib/event-streams": "./src/lib/event-streams.ts",
15
16
  "./types": "./src/types/index.ts"
16
17
  },
17
18
  "publish": {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@orq-ai/node",
3
- "version": "3.2.0-rc.62",
3
+ "version": "3.3.0-rc.9",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@orq-ai/node",
9
- "version": "3.2.0-rc.62",
9
+ "version": "3.3.0-rc.9",
10
10
  "bin": {
11
11
  "mcp": "bin/mcp-server.js"
12
12
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orq-ai/node",
3
- "version": "3.2.0-rc.62",
3
+ "version": "3.3.0-rc.9",
4
4
  "author": "Orq",
5
5
  "bin": {
6
6
  "mcp": "bin/mcp-server.js"
@@ -88,7 +88,6 @@ async function $do(
88
88
  const query = encodeFormQuery({
89
89
  "ending_before": payload?.ending_before,
90
90
  "limit": payload?.limit,
91
- "sort": payload?.sort,
92
91
  "starting_after": payload?.starting_after,
93
92
  });
94
93
 
@@ -95,7 +95,6 @@ async function $do(
95
95
  const query = encodeFormQuery({
96
96
  "ending_before": payload.ending_before,
97
97
  "limit": payload.limit,
98
- "sort": payload.sort,
99
98
  "starting_after": payload.starting_after,
100
99
  });
101
100
 
@@ -91,7 +91,6 @@ async function $do(
91
91
  const query = encodeFormQuery({
92
92
  "ending_before": payload?.ending_before,
93
93
  "limit": payload?.limit,
94
- "sort": payload?.sort,
95
94
  "starting_after": payload?.starting_after,
96
95
  });
97
96
 
@@ -0,0 +1,178 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { OrqCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import { EventStream } from "../lib/event-streams.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
14
+ import { pathToFunc } from "../lib/url.js";
15
+ import { APIError } from "../models/errors/apierror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.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
+ * Stream
30
+ *
31
+ * @remarks
32
+ * Stream deployment generation. Only supported for completions and chat completions.
33
+ */
34
+ export function deploymentsStream(
35
+ client: OrqCore,
36
+ request: operations.DeploymentStreamRequestBody,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ EventStream<operations.DeploymentStreamResponseBody>,
41
+ | APIError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
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.DeploymentStreamRequestBody,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ EventStream<operations.DeploymentStreamResponseBody>,
65
+ | APIError
66
+ | SDKValidationError
67
+ | UnexpectedClientError
68
+ | InvalidRequestError
69
+ | RequestAbortedError
70
+ | RequestTimeoutError
71
+ | ConnectionError
72
+ >,
73
+ APICall,
74
+ ]
75
+ > {
76
+ const parsed = safeParse(
77
+ request,
78
+ (value) =>
79
+ operations.DeploymentStreamRequestBody$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 = encodeJSON("body", payload, { explode: true });
87
+
88
+ const path = pathToFunc("/v2/deployments/stream")();
89
+
90
+ const headers = new Headers(compactMap({
91
+ "Content-Type": "application/json",
92
+ Accept: "text/event-stream",
93
+ "contactId": encodeSimple("contactId", client._options.contactId, {
94
+ explode: false,
95
+ charEncoding: "none",
96
+ }),
97
+ "environment": encodeSimple("environment", client._options.environment, {
98
+ explode: false,
99
+ charEncoding: "none",
100
+ }),
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
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
109
+ operationID: "DeploymentStream",
110
+ oAuth2Scopes: [],
111
+
112
+ resolvedSecurity: requestSecurity,
113
+
114
+ securitySource: client._options.apiKey,
115
+ retryConfig: options?.retries
116
+ || client._options.retryConfig
117
+ || { strategy: "none" },
118
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
119
+ };
120
+
121
+ const requestRes = client._createRequest(context, {
122
+ security: requestSecurity,
123
+ method: "POST",
124
+ baseURL: options?.serverURL,
125
+ path: path,
126
+ headers: headers,
127
+ body: body,
128
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
129
+ }, options);
130
+ if (!requestRes.ok) {
131
+ return [requestRes, { status: "invalid" }];
132
+ }
133
+ const req = requestRes.value;
134
+
135
+ const doResult = await client._do(req, {
136
+ context,
137
+ errorCodes: ["4XX", "5XX"],
138
+ retryConfig: context.retryConfig,
139
+ retryCodes: context.retryCodes,
140
+ });
141
+ if (!doResult.ok) {
142
+ return [doResult, { status: "request-error", request: req }];
143
+ }
144
+ const response = doResult.value;
145
+
146
+ const [result] = await M.match<
147
+ EventStream<operations.DeploymentStreamResponseBody>,
148
+ | APIError
149
+ | SDKValidationError
150
+ | UnexpectedClientError
151
+ | InvalidRequestError
152
+ | RequestAbortedError
153
+ | RequestTimeoutError
154
+ | ConnectionError
155
+ >(
156
+ M.sse(
157
+ 200,
158
+ z.instanceof(ReadableStream<Uint8Array>).transform(stream => {
159
+ return new EventStream({
160
+ stream,
161
+ decoder(rawEvent) {
162
+ const schema =
163
+ operations.DeploymentStreamResponseBody$inboundSchema;
164
+ return schema.parse(rawEvent);
165
+ },
166
+ });
167
+ }),
168
+ { sseSentinel: "[DONE]" },
169
+ ),
170
+ M.fail("4XX"),
171
+ M.fail("5XX"),
172
+ )(response);
173
+ if (!result.ok) {
174
+ return [result, { status: "complete", request: req, response }];
175
+ }
176
+
177
+ return [result, { status: "complete", request: req, response }];
178
+ }