@perplexity-ai/perplexity_ai 0.35.0 → 0.36.0

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 (52) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/async/chat/completions.d.mts +6 -0
  10. package/resources/async/chat/completions.d.mts.map +1 -1
  11. package/resources/async/chat/completions.d.ts +6 -0
  12. package/resources/async/chat/completions.d.ts.map +1 -1
  13. package/resources/chat/completions.d.mts +6 -0
  14. package/resources/chat/completions.d.mts.map +1 -1
  15. package/resources/chat/completions.d.ts +6 -0
  16. package/resources/chat/completions.d.ts.map +1 -1
  17. package/resources/index.d.mts +1 -1
  18. package/resources/index.d.mts.map +1 -1
  19. package/resources/index.d.ts +1 -1
  20. package/resources/index.d.ts.map +1 -1
  21. package/resources/index.js.map +1 -1
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/responses/index.d.mts +1 -1
  24. package/resources/responses/index.d.mts.map +1 -1
  25. package/resources/responses/index.d.ts +1 -1
  26. package/resources/responses/index.d.ts.map +1 -1
  27. package/resources/responses/index.js.map +1 -1
  28. package/resources/responses/index.mjs.map +1 -1
  29. package/resources/responses/responses.d.mts +77 -1
  30. package/resources/responses/responses.d.mts.map +1 -1
  31. package/resources/responses/responses.d.ts +77 -1
  32. package/resources/responses/responses.d.ts.map +1 -1
  33. package/resources/responses/responses.js +12 -0
  34. package/resources/responses/responses.js.map +1 -1
  35. package/resources/responses/responses.mjs +12 -0
  36. package/resources/responses/responses.mjs.map +1 -1
  37. package/resources/shared.d.mts +4 -0
  38. package/resources/shared.d.mts.map +1 -1
  39. package/resources/shared.d.ts +4 -0
  40. package/resources/shared.d.ts.map +1 -1
  41. package/src/client.ts +2 -0
  42. package/src/resources/async/chat/completions.ts +7 -0
  43. package/src/resources/chat/completions.ts +7 -0
  44. package/src/resources/index.ts +1 -0
  45. package/src/resources/responses/index.ts +1 -0
  46. package/src/resources/responses/responses.ts +92 -0
  47. package/src/resources/shared.ts +4 -0
  48. package/src/version.ts +1 -1
  49. package/version.d.mts +1 -1
  50. package/version.d.ts +1 -1
  51. package/version.js +1 -1
  52. package/version.mjs +1 -1
@@ -102,6 +102,13 @@ export interface CompletionCreateParamsBase {
102
102
  | CompletionCreateParams.ResponseFormatRegex
103
103
  | null;
104
104
 
105
+ /**
106
+ * Optional locale tag used for response formatting conventions. Locale-style
107
+ * values such as `es_mx`, `EN-us`, and `zh-TW` are normalized to the canonical
108
+ * form (`es-MX`, `en-US`, `zh-TW`). Invalid values are ignored.
109
+ */
110
+ response_formatting_locale?: string | null;
111
+
105
112
  response_metadata?: { [key: string]: unknown } | null;
106
113
 
107
114
  return_images?: boolean | null;
@@ -26,6 +26,7 @@ export {
26
26
  type ResponsesUsage,
27
27
  type ResponseCreateResponse,
28
28
  type ResponseRetrieveResponse,
29
+ type ResponseCancelResponse,
29
30
  type ResponseCreateParams,
30
31
  type ResponseCreateParamsNonStreaming,
31
32
  type ResponseCreateParamsStreaming,
@@ -17,6 +17,7 @@ export {
17
17
  type ResponsesUsage,
18
18
  type ResponseCreateResponse,
19
19
  type ResponseRetrieveResponse,
20
+ type ResponseCancelResponse,
20
21
  type ResponseCreateParams,
21
22
  type ResponseCreateParamsNonStreaming,
22
23
  type ResponseCreateParamsStreaming,
@@ -55,6 +55,19 @@ export class Responses extends APIResource {
55
55
  retrieve(responseID: string, options?: RequestOptions): APIPromise<ResponseRetrieveResponse> {
56
56
  return this._client.get(path`/v1/responses/${responseID}`, options);
57
57
  }
58
+
59
+ /**
60
+ * Request cancellation of a response. Acts on durable state, so it works for
61
+ * background responses that outlive the client connection as well as durably
62
+ * routed foreground responses. The cancel is asynchronous: a 200 acknowledges the
63
+ * request (status `cancelling`) and the run stops shortly after. Poll the retrieve
64
+ * endpoint for the terminal status. Cancelling a run that is already terminal
65
+ * returns 400. Ownership is enforced server side; an unknown id, or a response
66
+ * belonging to a different account, returns 404.
67
+ */
68
+ cancel(responseID: string, options?: RequestOptions): APIPromise<ResponseCancelResponse> {
69
+ return this._client.post(path`/v1/responses/${responseID}/cancel`, options);
70
+ }
58
71
  }
59
72
 
60
73
  /**
@@ -474,6 +487,19 @@ export namespace ResponseStreamChunk {
474
487
 
475
488
  error?: ResponsesAPI.ErrorInfo;
476
489
 
490
+ /**
491
+ * ID of the previous response in the chain, when the response was created with
492
+ * previous_response_id.
493
+ */
494
+ previous_response_id?: string | null;
495
+
496
+ /**
497
+ * Whether the response is stored and visible to later retrieve calls. A response
498
+ * created with store=false can still be used as a previous_response_id
499
+ * continuation source.
500
+ */
501
+ store?: boolean;
502
+
477
503
  usage?: ResponsesAPI.ResponsesUsage;
478
504
  }
479
505
  }
@@ -529,6 +555,19 @@ export namespace ResponseStreamChunk {
529
555
 
530
556
  error?: ResponsesAPI.ErrorInfo;
531
557
 
558
+ /**
559
+ * ID of the previous response in the chain, when the response was created with
560
+ * previous_response_id.
561
+ */
562
+ previous_response_id?: string | null;
563
+
564
+ /**
565
+ * Whether the response is stored and visible to later retrieve calls. A response
566
+ * created with store=false can still be used as a previous_response_id
567
+ * continuation source.
568
+ */
569
+ store?: boolean;
570
+
532
571
  usage?: ResponsesAPI.ResponsesUsage;
533
572
  }
534
573
  }
@@ -583,6 +622,19 @@ export namespace ResponseStreamChunk {
583
622
 
584
623
  error?: ResponsesAPI.ErrorInfo;
585
624
 
625
+ /**
626
+ * ID of the previous response in the chain, when the response was created with
627
+ * previous_response_id.
628
+ */
629
+ previous_response_id?: string | null;
630
+
631
+ /**
632
+ * Whether the response is stored and visible to later retrieve calls. A response
633
+ * created with store=false can still be used as a previous_response_id
634
+ * continuation source.
635
+ */
636
+ store?: boolean;
637
+
586
638
  usage?: ResponsesAPI.ResponsesUsage;
587
639
  }
588
640
  }
@@ -1162,6 +1214,19 @@ export interface ResponseCreateResponse {
1162
1214
 
1163
1215
  error?: ErrorInfo;
1164
1216
 
1217
+ /**
1218
+ * ID of the previous response in the chain, when the response was created with
1219
+ * previous_response_id.
1220
+ */
1221
+ previous_response_id?: string | null;
1222
+
1223
+ /**
1224
+ * Whether the response is stored and visible to later retrieve calls. A response
1225
+ * created with store=false can still be used as a previous_response_id
1226
+ * continuation source.
1227
+ */
1228
+ store?: boolean;
1229
+
1165
1230
  usage?: ResponsesUsage;
1166
1231
 
1167
1232
  /**
@@ -1200,6 +1265,19 @@ export interface ResponseRetrieveResponse {
1200
1265
 
1201
1266
  error?: ErrorInfo;
1202
1267
 
1268
+ /**
1269
+ * ID of the previous response in the chain, when the response was created with
1270
+ * previous_response_id.
1271
+ */
1272
+ previous_response_id?: string | null;
1273
+
1274
+ /**
1275
+ * Whether the response is stored and visible to later retrieve calls. A response
1276
+ * created with store=false can still be used as a previous_response_id
1277
+ * continuation source.
1278
+ */
1279
+ store?: boolean;
1280
+
1203
1281
  usage?: ResponsesUsage;
1204
1282
 
1205
1283
  /**
@@ -1209,6 +1287,19 @@ export interface ResponseRetrieveResponse {
1209
1287
  output_text?: string;
1210
1288
  }
1211
1289
 
1290
+ export interface ResponseCancelResponse {
1291
+ /**
1292
+ * The response id (resp\_...).
1293
+ */
1294
+ response_id: string;
1295
+
1296
+ /**
1297
+ * Always `cancelling`: the cancel was accepted and the run stops asynchronously.
1298
+ * An already terminal run returns 400 instead, so no terminal status appears here.
1299
+ */
1300
+ status: 'cancelling';
1301
+ }
1302
+
1212
1303
  export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming;
1213
1304
 
1214
1305
  export interface ResponseCreateParamsBase {
@@ -1489,6 +1580,7 @@ export declare namespace Responses {
1489
1580
  type ResponsesUsage as ResponsesUsage,
1490
1581
  type ResponseCreateResponse as ResponseCreateResponse,
1491
1582
  type ResponseRetrieveResponse as ResponseRetrieveResponse,
1583
+ type ResponseCancelResponse as ResponseCancelResponse,
1492
1584
  type ResponseCreateParams as ResponseCreateParams,
1493
1585
  type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming,
1494
1586
  type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming,
@@ -519,6 +519,10 @@ export namespace UsageInfo {
519
519
 
520
520
  reasoning_tokens_cost?: number | null;
521
521
 
522
+ /**
523
+ * Flat request cost for the chat completion. Present on completed (terminal)
524
+ * responses and omitted from the zero cost skeleton on interim streaming chunks.
525
+ */
522
526
  request_cost?: number | null;
523
527
 
524
528
  search_queries_cost?: number | null;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.35.0'; // x-release-please-version
1
+ export const VERSION = '0.36.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.35.0";
1
+ export declare const VERSION = "0.36.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.35.0";
1
+ export declare const VERSION = "0.36.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.35.0'; // x-release-please-version
4
+ exports.VERSION = '0.36.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.35.0'; // x-release-please-version
1
+ export const VERSION = '0.36.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map