openai 4.87.2 → 4.87.4

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 (45) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/index.d.mts +2 -2
  3. package/index.d.ts +2 -2
  4. package/index.d.ts.map +1 -1
  5. package/index.js.map +1 -1
  6. package/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/batches.d.ts +4 -4
  9. package/resources/batches.d.ts.map +1 -1
  10. package/resources/chat/completions/completions.d.ts +12 -6
  11. package/resources/chat/completions/completions.d.ts.map +1 -1
  12. package/resources/chat/completions/completions.js.map +1 -1
  13. package/resources/chat/completions/completions.mjs.map +1 -1
  14. package/resources/responses/index.d.ts +1 -1
  15. package/resources/responses/index.d.ts.map +1 -1
  16. package/resources/responses/index.js +1 -2
  17. package/resources/responses/index.js.map +1 -1
  18. package/resources/responses/index.mjs +1 -1
  19. package/resources/responses/index.mjs.map +1 -1
  20. package/resources/responses/input-items.d.ts +7 -121
  21. package/resources/responses/input-items.d.ts.map +1 -1
  22. package/resources/responses/input-items.js +4 -7
  23. package/resources/responses/input-items.js.map +1 -1
  24. package/resources/responses/input-items.mjs +3 -5
  25. package/resources/responses/input-items.mjs.map +1 -1
  26. package/resources/responses/responses.d.ts +190 -101
  27. package/resources/responses/responses.d.ts.map +1 -1
  28. package/resources/responses/responses.js +5 -2
  29. package/resources/responses/responses.js.map +1 -1
  30. package/resources/responses/responses.mjs +4 -2
  31. package/resources/responses/responses.mjs.map +1 -1
  32. package/resources/shared.d.ts +2 -2
  33. package/resources/shared.d.ts.map +1 -1
  34. package/src/index.ts +4 -0
  35. package/src/resources/batches.ts +4 -4
  36. package/src/resources/chat/completions/completions.ts +12 -6
  37. package/src/resources/responses/index.ts +1 -6
  38. package/src/resources/responses/input-items.ts +10 -199
  39. package/src/resources/responses/input-items.ts.orig +114 -0
  40. package/src/resources/responses/responses.ts +230 -118
  41. package/src/resources/shared.ts +2 -2
  42. package/src/version.ts +1 -1
  43. package/version.d.ts +1 -1
  44. package/version.js +1 -1
  45. package/version.mjs +1 -1
@@ -9,12 +9,13 @@ import {
9
9
  import * as Core from '../../core';
10
10
  import { APIPromise, isRequestOptions } from '../../core';
11
11
  import { APIResource } from '../../resource';
12
- import { Stream } from '../../streaming';
13
12
  import * as Shared from '../shared';
14
13
  import * as InputItemsAPI from './input-items';
15
- import { InputItemListParams, InputItems, ResponseItemList, ResponseItemListDataPage } from './input-items';
14
+ import { InputItemListParams, InputItems, ResponseItemList } from './input-items';
16
15
  import * as ResponsesAPI from './responses';
17
16
  import { ResponseStream, ResponseStreamParams } from '../../lib/responses/ResponseStream';
17
+ import { CursorPage } from '../../pagination';
18
+ import { Stream } from '../../streaming';
18
19
 
19
20
  export interface ParsedResponseOutputText<ParsedT> extends ResponseOutputText {
20
21
  parsed: ParsedT | null;
@@ -36,7 +37,7 @@ export type ParsedResponseOutputItem<ParsedT> =
36
37
  | ResponseFileSearchToolCall
37
38
  | ResponseFunctionWebSearch
38
39
  | ResponseComputerToolCall
39
- | ResponseOutputItem.Reasoning;
40
+ | ResponseReasoningItem;
40
41
 
41
42
  export interface ParsedResponse<ParsedT> extends Response {
42
43
  output: Array<ParsedResponseOutputItem<ParsedT>>;
@@ -137,6 +138,8 @@ export class Responses extends APIResource {
137
138
  }
138
139
  }
139
140
 
141
+ export class ResponseItemsPage extends CursorPage<ResponseItem> {}
142
+
140
143
  /**
141
144
  * A tool that controls a virtual computer. Learn more about the
142
145
  * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
@@ -966,6 +969,83 @@ export namespace ResponseComputerToolCall {
966
969
  }
967
970
  }
968
971
 
972
+ export interface ResponseComputerToolCallOutputItem {
973
+ /**
974
+ * The unique ID of the computer call tool output.
975
+ */
976
+ id: string;
977
+
978
+ /**
979
+ * The ID of the computer tool call that produced the output.
980
+ */
981
+ call_id: string;
982
+
983
+ /**
984
+ * A computer screenshot image used with the computer use tool.
985
+ */
986
+ output: ResponseComputerToolCallOutputScreenshot;
987
+
988
+ /**
989
+ * The type of the computer tool call output. Always `computer_call_output`.
990
+ */
991
+ type: 'computer_call_output';
992
+
993
+ /**
994
+ * The safety checks reported by the API that have been acknowledged by the
995
+ * developer.
996
+ */
997
+ acknowledged_safety_checks?: Array<ResponseComputerToolCallOutputItem.AcknowledgedSafetyCheck>;
998
+
999
+ /**
1000
+ * The status of the message input. One of `in_progress`, `completed`, or
1001
+ * `incomplete`. Populated when input items are returned via API.
1002
+ */
1003
+ status?: 'in_progress' | 'completed' | 'incomplete';
1004
+ }
1005
+
1006
+ export namespace ResponseComputerToolCallOutputItem {
1007
+ /**
1008
+ * A pending safety check for the computer call.
1009
+ */
1010
+ export interface AcknowledgedSafetyCheck {
1011
+ /**
1012
+ * The ID of the pending safety check.
1013
+ */
1014
+ id: string;
1015
+
1016
+ /**
1017
+ * The type of the pending safety check.
1018
+ */
1019
+ code: string;
1020
+
1021
+ /**
1022
+ * Details about the pending safety check.
1023
+ */
1024
+ message: string;
1025
+ }
1026
+ }
1027
+
1028
+ /**
1029
+ * A computer screenshot image used with the computer use tool.
1030
+ */
1031
+ export interface ResponseComputerToolCallOutputScreenshot {
1032
+ /**
1033
+ * Specifies the event type. For a computer screenshot, this property is always set
1034
+ * to `computer_screenshot`.
1035
+ */
1036
+ type: 'computer_screenshot';
1037
+
1038
+ /**
1039
+ * The identifier of an uploaded file that contains the screenshot.
1040
+ */
1041
+ file_id?: string;
1042
+
1043
+ /**
1044
+ * The URL of the screenshot image.
1045
+ */
1046
+ image_url?: string;
1047
+ }
1048
+
969
1049
  /**
970
1050
  * Multi-modal input and output contents.
971
1051
  */
@@ -1362,11 +1442,6 @@ export interface ResponseFunctionCallArgumentsDoneEvent {
1362
1442
  * for more information.
1363
1443
  */
1364
1444
  export interface ResponseFunctionToolCall {
1365
- /**
1366
- * The unique ID of the function tool call.
1367
- */
1368
- id: string;
1369
-
1370
1445
  /**
1371
1446
  * A JSON string of the arguments to pass to the function.
1372
1447
  */
@@ -1387,6 +1462,51 @@ export interface ResponseFunctionToolCall {
1387
1462
  */
1388
1463
  type: 'function_call';
1389
1464
 
1465
+ /**
1466
+ * The unique ID of the function tool call.
1467
+ */
1468
+ id?: string;
1469
+
1470
+ /**
1471
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1472
+ * Populated when items are returned via API.
1473
+ */
1474
+ status?: 'in_progress' | 'completed' | 'incomplete';
1475
+ }
1476
+
1477
+ /**
1478
+ * A tool call to run a function. See the
1479
+ * [function calling guide](https://platform.openai.com/docs/guides/function-calling)
1480
+ * for more information.
1481
+ */
1482
+ export interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {
1483
+ /**
1484
+ * The unique ID of the function call tool output.
1485
+ */
1486
+ id: string;
1487
+ }
1488
+
1489
+ export interface ResponseFunctionToolCallOutputItem {
1490
+ /**
1491
+ * The unique ID of the function call tool output.
1492
+ */
1493
+ id: string;
1494
+
1495
+ /**
1496
+ * The unique ID of the function tool call generated by the model.
1497
+ */
1498
+ call_id: string;
1499
+
1500
+ /**
1501
+ * A JSON string of the output of the function tool call.
1502
+ */
1503
+ output: string;
1504
+
1505
+ /**
1506
+ * The type of the function tool call output. Always `function_call_output`.
1507
+ */
1508
+ type: 'function_call_output';
1509
+
1390
1510
  /**
1391
1511
  * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1392
1512
  * Populated when items are returned via API.
@@ -1562,7 +1682,7 @@ export type ResponseInputItem =
1562
1682
  | ResponseFunctionWebSearch
1563
1683
  | ResponseFunctionToolCall
1564
1684
  | ResponseInputItem.FunctionCallOutput
1565
- | ResponseInputItem.Reasoning
1685
+ | ResponseReasoningItem
1566
1686
  | ResponseInputItem.ItemReference;
1567
1687
 
1568
1688
  export namespace ResponseInputItem {
@@ -1607,7 +1727,7 @@ export namespace ResponseInputItem {
1607
1727
  /**
1608
1728
  * A computer screenshot image used with the computer use tool.
1609
1729
  */
1610
- output: ComputerCallOutput.Output;
1730
+ output: ResponsesAPI.ResponseComputerToolCallOutputScreenshot;
1611
1731
 
1612
1732
  /**
1613
1733
  * The type of the computer tool call output. Always `computer_call_output`.
@@ -1633,27 +1753,6 @@ export namespace ResponseInputItem {
1633
1753
  }
1634
1754
 
1635
1755
  export namespace ComputerCallOutput {
1636
- /**
1637
- * A computer screenshot image used with the computer use tool.
1638
- */
1639
- export interface Output {
1640
- /**
1641
- * Specifies the event type. For a computer screenshot, this property is always set
1642
- * to `computer_screenshot`.
1643
- */
1644
- type: 'computer_screenshot';
1645
-
1646
- /**
1647
- * The identifier of an uploaded file that contains the screenshot.
1648
- */
1649
- file_id?: string;
1650
-
1651
- /**
1652
- * The URL of the screenshot image.
1653
- */
1654
- image_url?: string;
1655
- }
1656
-
1657
1756
  /**
1658
1757
  * A pending safety check for the computer call.
1659
1758
  */
@@ -1707,47 +1806,6 @@ export namespace ResponseInputItem {
1707
1806
  status?: 'in_progress' | 'completed' | 'incomplete';
1708
1807
  }
1709
1808
 
1710
- /**
1711
- * A description of the chain of thought used by a reasoning model while generating
1712
- * a response.
1713
- */
1714
- export interface Reasoning {
1715
- /**
1716
- * The unique identifier of the reasoning content.
1717
- */
1718
- id: string;
1719
-
1720
- /**
1721
- * Reasoning text contents.
1722
- */
1723
- content: Array<Reasoning.Content>;
1724
-
1725
- /**
1726
- * The type of the object. Always `reasoning`.
1727
- */
1728
- type: 'reasoning';
1729
-
1730
- /**
1731
- * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1732
- * Populated when items are returned via API.
1733
- */
1734
- status?: 'in_progress' | 'completed' | 'incomplete';
1735
- }
1736
-
1737
- export namespace Reasoning {
1738
- export interface Content {
1739
- /**
1740
- * A short summary of the reasoning used by the model when generating the response.
1741
- */
1742
- text: string;
1743
-
1744
- /**
1745
- * The type of the object. Always `text`.
1746
- */
1747
- type: 'reasoning_summary';
1748
- }
1749
- }
1750
-
1751
1809
  /**
1752
1810
  * An internal identifier for an item to reference.
1753
1811
  */
@@ -1770,6 +1828,35 @@ export namespace ResponseInputItem {
1770
1828
  */
1771
1829
  export type ResponseInputMessageContentList = Array<ResponseInputContent>;
1772
1830
 
1831
+ export interface ResponseInputMessageItem {
1832
+ /**
1833
+ * The unique ID of the message input.
1834
+ */
1835
+ id: string;
1836
+
1837
+ /**
1838
+ * A list of one or many input items to the model, containing different content
1839
+ * types.
1840
+ */
1841
+ content: ResponseInputMessageContentList;
1842
+
1843
+ /**
1844
+ * The role of the message input. One of `user`, `system`, or `developer`.
1845
+ */
1846
+ role: 'user' | 'system' | 'developer';
1847
+
1848
+ /**
1849
+ * The status of item. One of `in_progress`, `completed`, or `incomplete`.
1850
+ * Populated when items are returned via API.
1851
+ */
1852
+ status?: 'in_progress' | 'completed' | 'incomplete';
1853
+
1854
+ /**
1855
+ * The type of the message input. Always set to `message`.
1856
+ */
1857
+ type?: 'message';
1858
+ }
1859
+
1773
1860
  /**
1774
1861
  * A text input to the model.
1775
1862
  */
@@ -1785,6 +1872,19 @@ export interface ResponseInputText {
1785
1872
  type: 'input_text';
1786
1873
  }
1787
1874
 
1875
+ /**
1876
+ * Content item used to generate a response.
1877
+ */
1878
+ export type ResponseItem =
1879
+ | ResponseInputMessageItem
1880
+ | ResponseOutputMessage
1881
+ | ResponseFileSearchToolCall
1882
+ | ResponseComputerToolCall
1883
+ | ResponseComputerToolCallOutputItem
1884
+ | ResponseFunctionWebSearch
1885
+ | ResponseFunctionToolCallItem
1886
+ | ResponseFunctionToolCallOutputItem;
1887
+
1788
1888
  /**
1789
1889
  * An audio output from the model.
1790
1890
  */
@@ -1814,50 +1914,7 @@ export type ResponseOutputItem =
1814
1914
  | ResponseFunctionToolCall
1815
1915
  | ResponseFunctionWebSearch
1816
1916
  | ResponseComputerToolCall
1817
- | ResponseOutputItem.Reasoning;
1818
-
1819
- export namespace ResponseOutputItem {
1820
- /**
1821
- * A description of the chain of thought used by a reasoning model while generating
1822
- * a response.
1823
- */
1824
- export interface Reasoning {
1825
- /**
1826
- * The unique identifier of the reasoning content.
1827
- */
1828
- id: string;
1829
-
1830
- /**
1831
- * Reasoning text contents.
1832
- */
1833
- content: Array<Reasoning.Content>;
1834
-
1835
- /**
1836
- * The type of the object. Always `reasoning`.
1837
- */
1838
- type: 'reasoning';
1839
-
1840
- /**
1841
- * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
1842
- * Populated when items are returned via API.
1843
- */
1844
- status?: 'in_progress' | 'completed' | 'incomplete';
1845
- }
1846
-
1847
- export namespace Reasoning {
1848
- export interface Content {
1849
- /**
1850
- * A short summary of the reasoning used by the model when generating the response.
1851
- */
1852
- text: string;
1853
-
1854
- /**
1855
- * The type of the object. Always `text`.
1856
- */
1857
- type: 'reasoning_summary';
1858
- }
1859
- }
1860
- }
1917
+ | ResponseReasoningItem;
1861
1918
 
1862
1919
  /**
1863
1920
  * Emitted when a new output item is added.
@@ -2039,6 +2096,47 @@ export namespace ResponseOutputText {
2039
2096
  }
2040
2097
  }
2041
2098
 
2099
+ /**
2100
+ * A description of the chain of thought used by a reasoning model while generating
2101
+ * a response.
2102
+ */
2103
+ export interface ResponseReasoningItem {
2104
+ /**
2105
+ * The unique identifier of the reasoning content.
2106
+ */
2107
+ id: string;
2108
+
2109
+ /**
2110
+ * Reasoning text contents.
2111
+ */
2112
+ summary: Array<ResponseReasoningItem.Summary>;
2113
+
2114
+ /**
2115
+ * The type of the object. Always `reasoning`.
2116
+ */
2117
+ type: 'reasoning';
2118
+
2119
+ /**
2120
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
2121
+ * Populated when items are returned via API.
2122
+ */
2123
+ status?: 'in_progress' | 'completed' | 'incomplete';
2124
+ }
2125
+
2126
+ export namespace ResponseReasoningItem {
2127
+ export interface Summary {
2128
+ /**
2129
+ * A short summary of the reasoning used by the model when generating the response.
2130
+ */
2131
+ text: string;
2132
+
2133
+ /**
2134
+ * The type of the object. Always `summary_text`.
2135
+ */
2136
+ type: 'summary_text';
2137
+ }
2138
+ }
2139
+
2042
2140
  /**
2043
2141
  * Emitted when there is a partial refusal text.
2044
2142
  */
@@ -2348,6 +2446,11 @@ export interface ResponseUsage {
2348
2446
  */
2349
2447
  input_tokens: number;
2350
2448
 
2449
+ /**
2450
+ * A detailed breakdown of the input tokens.
2451
+ */
2452
+ input_tokens_details: ResponseUsage.InputTokensDetails;
2453
+
2351
2454
  /**
2352
2455
  * The number of output tokens.
2353
2456
  */
@@ -2365,6 +2468,17 @@ export interface ResponseUsage {
2365
2468
  }
2366
2469
 
2367
2470
  export namespace ResponseUsage {
2471
+ /**
2472
+ * A detailed breakdown of the input tokens.
2473
+ */
2474
+ export interface InputTokensDetails {
2475
+ /**
2476
+ * The number of tokens that were retrieved from the cache.
2477
+ * [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).
2478
+ */
2479
+ cached_tokens: number;
2480
+ }
2481
+
2368
2482
  /**
2369
2483
  * A detailed breakdown of the output tokens.
2370
2484
  */
@@ -2749,13 +2863,11 @@ export interface ResponseRetrieveParams {
2749
2863
  }
2750
2864
 
2751
2865
  Responses.InputItems = InputItems;
2752
- Responses.ResponseItemListDataPage = ResponseItemListDataPage;
2753
2866
 
2754
2867
  export declare namespace Responses {
2755
2868
  export {
2756
2869
  InputItems as InputItems,
2757
2870
  type ResponseItemList as ResponseItemList,
2758
- ResponseItemListDataPage as ResponseItemListDataPage,
2759
2871
  type InputItemListParams as InputItemListParams,
2760
2872
  };
2761
2873
  }
@@ -171,10 +171,10 @@ export interface Reasoning {
171
171
  * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
172
172
  * result in faster responses and fewer tokens used on reasoning in a response.
173
173
  */
174
- effort: ReasoningEffort | null;
174
+ effort?: ReasoningEffort | null;
175
175
 
176
176
  /**
177
- * **o-series models only**
177
+ * **computer_use_preview only**
178
178
  *
179
179
  * A summary of the reasoning performed by the model. This can be useful for
180
180
  * debugging and understanding the model's reasoning process. One of `concise` or
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '4.87.2'; // x-release-please-version
1
+ export const VERSION = '4.87.4'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "4.87.2";
1
+ export declare const VERSION = "4.87.4";
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 = '4.87.2'; // x-release-please-version
4
+ exports.VERSION = '4.87.4'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '4.87.2'; // x-release-please-version
1
+ export const VERSION = '4.87.4'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map