diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 88f780d30..4e19f03d6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.96.2" + ".": "4.97.0" } diff --git a/.stats.yml b/.stats.yml index d92408173..0c8278866 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml -openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03 -config_hash: b597cd9a31e9e5ec709e2eefb4c54122 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml +openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6 +config_hash: d9b6b6e6bc85744663e300eebc482067 diff --git a/CHANGELOG.md b/CHANGELOG.md index d724d8922..6fa637742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 4.97.0 (2025-05-02) + +Full Changelog: [v4.96.2...v4.97.0](https://github.com/openai/openai-node/compare/v4.96.2...v4.97.0) + +### Features + +* **api:** add image sizes, reasoning encryption ([9c2113a](https://github.com/openai/openai-node/commit/9c2113af7c7ea9a797a0e39d07d9ad8627c96acb)) + + +### Chores + +* **docs:** add missing deprecation warnings ([253392c](https://github.com/openai/openai-node/commit/253392c93adca88e0ee83f784183b2128ff64a16)) + + +### Documentation + +* fix "procesing" -> "processing" in realtime examples ([#1406](https://github.com/openai/openai-node/issues/1406)) ([8717b9f](https://github.com/openai/openai-node/commit/8717b9fce87d03e51d40ee58f5d6259408405e1f)) +* **readme:** fix typo ([cab3478](https://github.com/openai/openai-node/commit/cab3478f195f9de5c21033a1b3684f52ad347ffc)) + ## 4.96.2 (2025-04-29) Full Changelog: [v4.96.1...v4.96.2](https://github.com/openai/openai-node/compare/v4.96.1...v4.96.2) diff --git a/README.md b/README.md index 8515c81ed..bbf72226a 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ async function main() { main(); ``` -Error codes are as followed: +Error codes are as follows: | Status Code | Error Type | | ----------- | -------------------------- | diff --git a/examples/azure/realtime/websocket.ts b/examples/azure/realtime/websocket.ts index bec74e654..4175b4a71 100644 --- a/examples/azure/realtime/websocket.ts +++ b/examples/azure/realtime/websocket.ts @@ -40,7 +40,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -57,4 +57,4 @@ async function main() { rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/examples/azure/realtime/ws.ts b/examples/azure/realtime/ws.ts index 6ab7b742a..e86a79092 100644 --- a/examples/azure/realtime/ws.ts +++ b/examples/azure/realtime/ws.ts @@ -40,7 +40,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -57,4 +57,4 @@ async function main() { rt.socket.on('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/examples/realtime/websocket.ts b/examples/realtime/websocket.ts index 0da131bc3..f1c46dd41 100644 --- a/examples/realtime/websocket.ts +++ b/examples/realtime/websocket.ts @@ -28,7 +28,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -45,4 +45,4 @@ async function main() { rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/examples/realtime/ws.ts b/examples/realtime/ws.ts index 08c6fbcb6..1ce6b2045 100644 --- a/examples/realtime/ws.ts +++ b/examples/realtime/ws.ts @@ -28,7 +28,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -45,4 +45,4 @@ async function main() { rt.socket.on('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/jsr.json b/jsr.json index 8eca06e74..fd3ca4a41 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.96.2", + "version": "4.97.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index d563394c0..8b9281b35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.96.2", + "version": "4.97.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/realtime.md b/realtime.md index 2fcd17e9e..7e8d84a3c 100644 --- a/realtime.md +++ b/realtime.md @@ -39,7 +39,7 @@ rt.socket.on('open', () => { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -80,8 +80,7 @@ It is **highly recommended** that you register an `error` event listener and han const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); -``` - +``` \ No newline at end of file diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 4b99ee5f4..e218c8299 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -66,7 +66,7 @@ export interface SpeechCreateParams { /** * The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is - * the default. + * the default. Does not work with `gpt-4o-mini-tts`. */ speed?: number; } diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 17edac02c..251020337 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1169,7 +1169,7 @@ export interface ChatCompletionCreateParamsBase { frequency_penalty?: number | null; /** - * Deprecated in favor of `tool_choice`. + * @deprecated Deprecated in favor of `tool_choice`. * * Controls which (if any) function is called by the model. * @@ -1187,7 +1187,7 @@ export interface ChatCompletionCreateParamsBase { function_call?: 'none' | 'auto' | ChatCompletionFunctionCallOption; /** - * Deprecated in favor of `tools`. + * @deprecated Deprecated in favor of `tools`. * * A list of functions the model may generate JSON inputs for. */ @@ -1220,8 +1220,8 @@ export interface ChatCompletionCreateParamsBase { max_completion_tokens?: number | null; /** - * The maximum number of [tokens](/tokenizer) that can be generated in the chat - * completion. This value can be used to control + * @deprecated The maximum number of [tokens](/tokenizer) that can be generated in + * the chat completion. This value can be used to control * [costs](https://openai.com/api/pricing/) for text generated via API. * * This value is now deprecated in favor of `max_completion_tokens`, and is not diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 9be03c302..2198e8174 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -466,8 +466,9 @@ export interface JobCreateParams { training_file: string; /** - * The hyperparameters used for the fine-tuning job. This value is now deprecated - * in favor of `method`, and should be passed in under the `method` parameter. + * @deprecated The hyperparameters used for the fine-tuning job. This value is now + * deprecated in favor of `method`, and should be passed in under the `method` + * parameter. */ hyperparameters?: JobCreateParams.Hyperparameters; diff --git a/src/resources/images.ts b/src/resources/images.ts index de1882d30..32f1e123c 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -162,10 +162,13 @@ export interface ImageCreateVariationParams { export interface ImageEditParams { /** - * The image(s) to edit. Must be a supported image file or an array of images. For - * `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than - * 25MB. For `dall-e-2`, you can only provide one image, and it should be a square - * `png` file less than 4MB. + * The image(s) to edit. Must be a supported image file or an array of images. + * + * For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than + * 25MB. You can provide up to 16 images. + * + * For `dall-e-2`, you can only provide one image, and it should be a square `png` + * file less than 4MB. */ image: Core.Uploadable | Array; @@ -175,6 +178,17 @@ export interface ImageEditParams { */ prompt: string; + /** + * Allows to set transparency for the background of the generated image(s). This + * parameter is only supported for `gpt-image-1`. Must be one of `transparent`, + * `opaque` or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * If `transparent`, the output format needs to support transparency, so it should + * be set to either `png` (default value) or `webp`. + */ + background?: 'transparent' | 'opaque' | 'auto' | null; + /** * An additional image whose fully transparent areas (e.g. where alpha is zero) * indicate where `image` should be edited. If there are multiple images provided, @@ -215,7 +229,7 @@ export interface ImageEditParams { * (landscape), `1024x1536` (portrait), or `auto` (default value) for * `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. */ - size?: '256x256' | '512x512' | '1024x1024' | null; + size?: '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | 'auto' | null; /** * A unique identifier representing your end-user, which can help OpenAI to monitor diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 771b8daf2..0a6e3666d 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -158,7 +158,7 @@ export interface ComputerTool { /** * The type of computer environment to control. */ - environment: 'mac' | 'windows' | 'ubuntu' | 'browser'; + environment: 'windows' | 'mac' | 'linux' | 'ubuntu' | 'browser'; /** * The type of the computer use tool. Always `computer_use_preview`. @@ -209,9 +209,9 @@ export interface FileSearchTool { vector_store_ids: Array; /** - * A filter to apply based on file attributes. + * A filter to apply. */ - filters?: Shared.ComparisonFilter | Shared.CompoundFilter; + filters?: Shared.ComparisonFilter | Shared.CompoundFilter | null; /** * The maximum number of results to return. This number should be between 1 and 50 @@ -258,12 +258,12 @@ export interface FunctionTool { /** * A JSON schema object describing the parameters of the function. */ - parameters: Record; + parameters: Record | null; /** * Whether to enforce strict parameter validation. Default `true`. */ - strict: boolean; + strict: boolean | null; /** * The type of the function tool. Always `function`. @@ -1581,11 +1581,17 @@ export interface ResponseInProgressEvent { * - `message.input_image.image_url`: Include image urls from the input message. * - `computer_call_output.output.image_url`: Include image urls from the computer * call output. + * - `reasoning.encrypted_content`: Includes an encrypted version of reasoning + * tokens in reasoning item outputs. This enables reasoning items to be used in + * multi-turn conversations when using the Responses API statelessly (like when + * the `store` parameter is set to `false`, or when an organization is enrolled + * in the zero data retention program). */ export type ResponseIncludable = | 'file_search_call.results' | 'message.input_image.image_url' - | 'computer_call_output.output.image_url'; + | 'computer_call_output.output.image_url' + | 'reasoning.encrypted_content'; /** * An event that is emitted when a response finishes as incomplete. @@ -1650,7 +1656,7 @@ export interface ResponseInputFile { /** * The ID of the file to be sent to the model. */ - file_id?: string; + file_id?: string | null; /** * The name of the file to be sent to the model. @@ -1667,7 +1673,7 @@ export interface ResponseInputImage { * The detail level of the image to be sent to the model. One of `high`, `low`, or * `auto`. Defaults to `auto`. */ - detail: 'high' | 'low' | 'auto'; + detail: 'low' | 'high' | 'auto'; /** * The type of the input item. Always `input_image`. @@ -1758,19 +1764,19 @@ export namespace ResponseInputItem { /** * The ID of the computer tool call output. */ - id?: string; + id?: string | null; /** * The safety checks reported by the API that have been acknowledged by the * developer. */ - acknowledged_safety_checks?: Array; + acknowledged_safety_checks?: Array | null; /** * The status of the message input. One of `in_progress`, `completed`, or * `incomplete`. Populated when input items are returned via API. */ - status?: 'in_progress' | 'completed' | 'incomplete'; + status?: 'in_progress' | 'completed' | 'incomplete' | null; } export namespace ComputerCallOutput { @@ -1786,12 +1792,12 @@ export namespace ResponseInputItem { /** * The type of the pending safety check. */ - code: string; + code?: string | null; /** * Details about the pending safety check. */ - message: string; + message?: string | null; } } @@ -1818,13 +1824,13 @@ export namespace ResponseInputItem { * The unique ID of the function tool call output. Populated when this item is * returned via API. */ - id?: string; + id?: string | null; /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. */ - status?: 'in_progress' | 'completed' | 'incomplete'; + status?: 'in_progress' | 'completed' | 'incomplete' | null; } /** @@ -1839,7 +1845,7 @@ export namespace ResponseInputItem { /** * The type of item to reference. Always `item_reference`. */ - type: 'item_reference'; + type?: 'item_reference' | null; } } @@ -2119,7 +2125,9 @@ export namespace ResponseOutputText { /** * A description of the chain of thought used by a reasoning model while generating - * a response. + * a response. Be sure to include these items in your `input` to the Responses API + * for subsequent turns of a conversation if you are manually + * [managing context](https://platform.openai.com/docs/guides/conversation-state). */ export interface ResponseReasoningItem { /** @@ -2137,6 +2145,12 @@ export interface ResponseReasoningItem { */ type: 'reasoning'; + /** + * The encrypted content of the reasoning item - populated when a response is + * generated with `reasoning.encrypted_content` in the `include` parameter. + */ + encrypted_content?: string | null; + /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. @@ -2730,11 +2744,9 @@ export interface ResponseWebSearchCallSearchingEvent { } /** - * A tool that searches for relevant content from uploaded files. Learn more about - * the - * [file search tool](https://platform.openai.com/docs/guides/tools-file-search). + * A tool that can be used to generate a response. */ -export type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool; +export type Tool = FileSearchTool | FunctionTool | WebSearchTool | ComputerTool; /** * Use this option to force the model to call a specific function. @@ -2788,10 +2800,8 @@ export interface ToolChoiceTypes { */ export interface WebSearchTool { /** - * The type of the web search tool. One of: - * - * - `web_search_preview` - * - `web_search_preview_2025_03_11` + * The type of the web search tool. One of `web_search_preview` or + * `web_search_preview_2025_03_11`. */ type: 'web_search_preview' | 'web_search_preview_2025_03_11'; @@ -2801,10 +2811,16 @@ export interface WebSearchTool { */ search_context_size?: 'low' | 'medium' | 'high'; + /** + * The user's location. + */ user_location?: WebSearchTool.UserLocation | null; } export namespace WebSearchTool { + /** + * The user's location. + */ export interface UserLocation { /** * The type of location approximation. Always `approximate`. @@ -2814,24 +2830,24 @@ export namespace WebSearchTool { /** * Free text input for the city of the user, e.g. `San Francisco`. */ - city?: string; + city?: string | null; /** * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of * the user, e.g. `US`. */ - country?: string; + country?: string | null; /** * Free text input for the region of the user, e.g. `California`. */ - region?: string; + region?: string | null; /** * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the * user, e.g. `America/Los_Angeles`. */ - timezone?: string; + timezone?: string | null; } } @@ -2869,6 +2885,11 @@ export interface ResponseCreateParamsBase { * - `message.input_image.image_url`: Include image urls from the input message. * - `computer_call_output.output.image_url`: Include image urls from the computer * call output. + * - `reasoning.encrypted_content`: Includes an encrypted version of reasoning + * tokens in reasoning item outputs. This enables reasoning items to be used in + * multi-turn conversations when using the Responses API statelessly (like when + * the `store` parameter is set to `false`, or when an organization is enrolled + * in the zero data retention program). */ include?: Array | null; diff --git a/src/version.ts b/src/version.ts index 1674d74fe..97cbc5900 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.96.2'; // x-release-please-version +export const VERSION = '4.97.0'; // x-release-please-version diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index e9b460254..04fca0a2a 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -51,6 +51,7 @@ describe('resource images', () => { const response = await client.images.edit({ image: await toFile(Buffer.from('# my file contents'), 'README.md'), prompt: 'A cute baby sea otter wearing a beret', + background: 'transparent', mask: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'string', n: 1,