diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2e7a9a670..dc998f68e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "6.25.0" + ".": "6.26.0" } diff --git a/.stats.yml b/.stats.yml index 6d7b67e1b..2e994a70d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 147 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6bfe886b5ded0fe3bf37ca672698814e16e0836a093ceef65dac37ae44d1ad6b.yml -openapi_spec_hash: 6b1344a59044318e824c8d1af96033c7 -config_hash: 7f49c38fa3abe9b7038ffe62262c4912 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9c802d45a9bf2a896b5fd22ac22bba185e8a145bd40ed242df9bb87a05e954eb.yml +openapi_spec_hash: 97984ed69285e660b7d5c810c69ed449 +config_hash: acb0b1eb5d7284bfedaddb29f7f5a691 diff --git a/CHANGELOG.md b/CHANGELOG.md index 149815c67..7580a0326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## 6.26.0 (2026-03-05) + +Full Changelog: [v6.25.0...v6.26.0](https://github.com/openai/openai-node/compare/v6.25.0...v6.26.0) + +### Features + +* **api:** gpt-5.4, tool search tool, and new computer tool ([1d1e5a9](https://github.com/openai/openai-node/commit/1d1e5a9b5aeb11b0e940b4532dcd6a3fcc23898a)) + + +### Bug Fixes + +* **api:** internal schema fixes ([6b401ad](https://github.com/openai/openai-node/commit/6b401ad7d3ff2ead9cfa577daf8381f62ea85b93)) +* **api:** manual updates ([2b54919](https://github.com/openai/openai-node/commit/2b549195c70581022d9d64c443ab08202c6faeb7)) +* **api:** readd phase ([4a0cf29](https://github.com/openai/openai-node/commit/4a0cf2974865519d3b512fb377bc4ba305dce7b7)) +* **api:** remove phase from message types, prompt_cache_key param in responses ([088fca6](https://github.com/openai/openai-node/commit/088fca6a4d5d1a577500acb5579ee403292d8911)) + + +### Chores + +* **internal:** codegen related update ([6a0aa9e](https://github.com/openai/openai-node/commit/6a0aa9e2ff10e78f8b9afd777174d16537a29c8e)) +* **internal:** codegen related update ([b2a4299](https://github.com/openai/openai-node/commit/b2a42991cbe83eee45a342f19a5a99ce1d78b36a)) +* **internal:** move stringifyQuery implementation to internal function ([f9f4660](https://github.com/openai/openai-node/commit/f9f46609cf5c1fc51e437c23251c5a7d0519d55d)) +* **internal:** reduce warnings ([7e19492](https://github.com/openai/openai-node/commit/7e194929156052b0efbda9ca48c3ed6de8c18d2f)) + ## 6.25.0 (2026-02-24) Full Changelog: [v6.24.0...v6.25.0](https://github.com/openai/openai-node/compare/v6.24.0...v6.25.0) diff --git a/MIGRATION.md b/MIGRATION.md index ee72f5855..1dabf5c06 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -127,6 +127,7 @@ client.example.list(undefined, { headers: { ... } }); - `client.fineTuning.jobs.listEvents()` - `client.fineTuning.jobs.checkpoints.list()` - `client.fineTuning.checkpoints.permissions.retrieve()` +- `client.fineTuning.checkpoints.permissions.list()` - `client.vectorStores.list()` - `client.vectorStores.files.list()` - `client.beta.chatkit.threads.list()` diff --git a/api.md b/api.md index bc543fd86..c68de8a62 100644 --- a/api.md +++ b/api.md @@ -273,12 +273,14 @@ Types: - PermissionCreateResponse - PermissionRetrieveResponse +- PermissionListResponse - PermissionDeleteResponse Methods: - client.fineTuning.checkpoints.permissions.create(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage - client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse +- client.fineTuning.checkpoints.permissions.list(fineTunedModelCheckpoint, { ...params }) -> PermissionListResponsesPage - client.fineTuning.checkpoints.permissions.delete(permissionID, { ...params }) -> PermissionDeleteResponse ## Alpha diff --git a/jsr.json b/jsr.json index eac975a68..2d9ffc931 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "6.25.0", + "version": "6.26.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index f0bd61dab..c792858fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "6.25.0", + "version": "6.26.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/mock b/scripts/mock index 0b28f6ea2..bcf3b392b 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then + # Pre-install the package so the download doesn't eat into the startup timeout + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - # Wait for server to come online + # Wait for server to come online (max 30s) echo -n "Waiting for server" + attempts=0 while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Prism server to start" + cat .prism.log + exit 1 + fi echo -n "." sleep 0.1 done diff --git a/src/client.ts b/src/client.ts index b2032ff9f..63357d3ca 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,7 +11,7 @@ import type { APIResponseProps } from './internal/parse'; import { getPlatformHeaders } from './internal/detect-platform'; import * as Shims from './internal/shims'; import * as Opts from './internal/request-options'; -import * as qs from './internal/qs'; +import { stringifyQuery } from './internal/utils/query'; import { VERSION } from './version'; import * as Errors from './core/error'; import * as Pagination from './core/pagination'; @@ -467,8 +467,8 @@ export class OpenAI { return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]); } - protected stringifyQuery(query: Record): string { - return qs.stringify(query, { arrayFormat: 'brackets' }); + protected stringifyQuery(query: object | Record): string { + return stringifyQuery(query); } private getUserAgent(): string { @@ -530,7 +530,7 @@ export class OpenAI { } if (typeof query === 'object' && query && !Array.isArray(query)) { - url.search = this.stringifyQuery(query as Record); + url.search = this.stringifyQuery(query); } return url.toString(); @@ -865,9 +865,9 @@ export class OpenAI { } } - // If the API asks us to wait a certain amount of time (and it's a reasonable amount), - // just do what it says, but otherwise calculate a default - if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) { + // If the API asks us to wait a certain amount of time, just do what it + // says, but otherwise calculate a default + if (timeoutMillis === undefined) { const maxRetries = options.maxRetries ?? this.maxRetries; timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); } @@ -1001,7 +1001,7 @@ export class OpenAI { ) { return { bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' }, - body: this.stringifyQuery(body as Record), + body: this.stringifyQuery(body), }; } else { return this.#encoder({ body, headers }); @@ -1028,24 +1028,54 @@ export class OpenAI { static toFile = Uploads.toFile; + /** + * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. + */ completions: API.Completions = new API.Completions(this); chat: API.Chat = new API.Chat(this); + /** + * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. + */ embeddings: API.Embeddings = new API.Embeddings(this); + /** + * Files are used to upload documents that can be used with features like Assistants and Fine-tuning. + */ files: API.Files = new API.Files(this); + /** + * Given a prompt and/or an input image, the model will generate a new image. + */ images: API.Images = new API.Images(this); audio: API.Audio = new API.Audio(this); + /** + * Given text and/or image inputs, classifies if those inputs are potentially harmful. + */ moderations: API.Moderations = new API.Moderations(this); + /** + * List and describe the various models available in the API. + */ models: API.Models = new API.Models(this); fineTuning: API.FineTuning = new API.FineTuning(this); graders: API.Graders = new API.Graders(this); vectorStores: API.VectorStores = new API.VectorStores(this); webhooks: API.Webhooks = new API.Webhooks(this); beta: API.Beta = new API.Beta(this); + /** + * Create large batches of API requests to run asynchronously. + */ batches: API.Batches = new API.Batches(this); + /** + * Use Uploads to upload large files in multiple parts. + */ uploads: API.Uploads = new API.Uploads(this); responses: API.Responses = new API.Responses(this); realtime: API.Realtime = new API.Realtime(this); + /** + * Manage conversations and conversation items. + */ conversations: API.Conversations = new API.Conversations(this); + /** + * Manage and run evals in the OpenAI platform. + */ evals: API.Evals = new API.Evals(this); containers: API.Containers = new API.Containers(this); skills: API.Skills = new API.Skills(this); diff --git a/src/internal/utils.ts b/src/internal/utils.ts index 3cbfacce2..c591353b7 100644 --- a/src/internal/utils.ts +++ b/src/internal/utils.ts @@ -6,3 +6,4 @@ export * from './utils/env'; export * from './utils/log'; export * from './utils/uuid'; export * from './utils/sleep'; +export * from './utils/query'; diff --git a/src/internal/utils/query.ts b/src/internal/utils/query.ts new file mode 100644 index 000000000..f7d1b4b2f --- /dev/null +++ b/src/internal/utils/query.ts @@ -0,0 +1,7 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as qs from '../qs/stringify'; + +export function stringifyQuery(query: object | Record) { + return qs.stringify(query, { arrayFormat: 'brackets' }); +} diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 41aa2c43c..cdc8bb29c 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -5,6 +5,9 @@ import { APIPromise } from '../../core/api-promise'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; +/** + * Turn audio into text or text into audio. + */ export class Speech extends APIResource { /** * Generates audio from the input text. diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 8d39679a1..4c3f2da65 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -9,6 +9,9 @@ import { type Uploadable } from '../../core/uploads'; import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; +/** + * Turn audio into text or text into audio. + */ export class Transcriptions extends APIResource { /** * Transcribes audio into the input language. diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 2e8c8f4a4..c043bc4b4 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -8,6 +8,9 @@ import { type Uploadable } from '../../core/uploads'; import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; +/** + * Turn audio into text or text into audio. + */ export class Translations extends APIResource { /** * Translates audio into English. diff --git a/src/resources/batches.ts b/src/resources/batches.ts index 36f98a402..6825e19c5 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -8,6 +8,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../core/paginati import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; +/** + * Create large batches of API requests to run asynchronously. + */ export class Batches extends APIResource { /** * Creates and executes a batch from an uploaded file of requests diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 3fcf4cf4b..d2ea3c04c 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -13,6 +13,9 @@ import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; import { AssistantStream } from '../../lib/AssistantStream'; +/** + * Build Assistants that can call models and use tools. + */ export class Assistants extends APIResource { /** * Create an assistant with a model and instructions. @@ -1256,8 +1259,9 @@ export namespace AssistantCreateParams { /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to - * add to the vector store. There can be a maximum of 10000 files in a vector - * store. + * add to the vector store. For vector stores created before Nov 2025, there can be + * a maximum of 10,000 files in a vector store. For vector stores created starting + * in Nov 2025, the limit is 100,000,000 files. */ file_ids?: Array; diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index b487d3988..c98c984da 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -10,6 +10,8 @@ import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; /** + * Build Assistants that can call models and use tools. + * * @deprecated The Assistants API is deprecated in favor of the Responses API */ export class Messages extends APIResource { diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 218f94817..c47fd5cb4 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -42,6 +42,8 @@ import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStrea import { path } from '../../../../internal/utils/path'; /** + * Build Assistants that can call models and use tools. + * * @deprecated The Assistants API is deprecated in favor of the Responses API */ export class Runs extends APIResource { diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index bbbafb543..4e43f5d7e 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -10,6 +10,8 @@ import { RequestOptions } from '../../../../internal/request-options'; import { path } from '../../../../internal/utils/path'; /** + * Build Assistants that can call models and use tools. + * * @deprecated The Assistants API is deprecated in favor of the Responses API */ export class Steps extends APIResource { diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index b72949a0f..2cab55e69 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -73,6 +73,8 @@ import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../li import { path } from '../../../internal/utils/path'; /** + * Build Assistants that can call models and use tools. + * * @deprecated The Assistants API is deprecated in favor of the Responses API */ export class Threads extends APIResource { @@ -450,8 +452,9 @@ export namespace ThreadCreateParams { /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to - * add to the vector store. There can be a maximum of 10000 files in a vector - * store. + * add to the vector store. For vector stores created before Nov 2025, there can be + * a maximum of 10,000 files in a vector store. For vector stores created starting + * in Nov 2025, the limit is 100,000,000 files. */ file_ids?: Array; @@ -846,8 +849,9 @@ export namespace ThreadCreateAndRunParams { /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to - * add to the vector store. There can be a maximum of 10000 files in a vector - * store. + * add to the vector store. For vector stores created before Nov 2025, there can be + * a maximum of 10,000 files in a vector store. For vector stores created starting + * in Nov 2025, the limit is 100,000,000 files. */ file_ids?: Array; diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index a5daa7a5d..62e9c1228 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -20,6 +20,9 @@ import { ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatComple import { ChatCompletionStream, type ChatCompletionStreamParams } from '../../../lib/ChatCompletionStream'; import { ExtractParsedContentFromParams, parseChatCompletion, validateInputTools } from '../../../lib/parser'; +/** + * Given a list of messages comprising a conversation, the model will return a response. + */ export class Completions extends APIResource { messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); @@ -50,7 +53,7 @@ export class Completions extends APIResource { * const chatCompletion = await client.chat.completions.create( * { * messages: [{ content: 'string', role: 'developer' }], - * model: 'gpt-4o', + * model: 'gpt-5.4', * }, * ); * ``` diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts index ee16e3269..496521241 100644 --- a/src/resources/chat/completions/messages.ts +++ b/src/resources/chat/completions/messages.ts @@ -7,6 +7,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pa import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +/** + * Given a list of messages comprising a conversation, the model will return a response. + */ export class Messages extends APIResource { /** * Get the messages in a stored chat completion. Only Chat Completions that have diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 79ca5b7e6..45af3f400 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -7,6 +7,9 @@ import { APIPromise } from '../core/api-promise'; import { Stream } from '../core/streaming'; import { RequestOptions } from '../internal/request-options'; +/** + * Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. + */ export class Completions extends APIResource { /** * Creates a completion for the provided prompt and parameters. diff --git a/src/resources/conversations/conversations.ts b/src/resources/conversations/conversations.ts index b1bcbf7b0..6211298f0 100644 --- a/src/resources/conversations/conversations.ts +++ b/src/resources/conversations/conversations.ts @@ -18,6 +18,9 @@ import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; +/** + * Manage conversations and conversation items. + */ export class Conversations extends APIResource { items: ItemsAPI.Items = new ItemsAPI.Items(this._client); @@ -61,6 +64,12 @@ export class Conversations extends APIResource { * A screenshot of a computer. */ export interface ComputerScreenshotContent { + /** + * The detail level of the screenshot image to be sent to the model. One of `high`, + * `low`, `auto`, or `original`. Defaults to `auto`. + */ + detail: 'low' | 'high' | 'auto' | 'original'; + /** * The identifier of an uploaded file that contains the screenshot. */ diff --git a/src/resources/conversations/items.ts b/src/resources/conversations/items.ts index 0e3ae0140..2385a0465 100644 --- a/src/resources/conversations/items.ts +++ b/src/resources/conversations/items.ts @@ -12,6 +12,9 @@ import { import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; +/** + * Manage conversations and conversation items. + */ export class Items extends APIResource { /** * Create items in a conversation with the given ID. @@ -85,6 +88,8 @@ export type ConversationItem = | ConversationItem.ImageGenerationCall | ResponsesAPI.ResponseComputerToolCall | ResponsesAPI.ResponseComputerToolCallOutputItem + | ResponsesAPI.ResponseToolSearchCall + | ResponsesAPI.ResponseToolSearchOutputItem | ResponsesAPI.ResponseReasoningItem | ResponsesAPI.ResponseCodeInterpreterToolCall | ConversationItem.LocalShellCall diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index 7a66904f7..e5b8ecbd0 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -5,6 +5,9 @@ import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; import { loggerFor, toFloat32Array } from '../internal/utils'; +/** + * Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. + */ export class Embeddings extends APIResource { /** * Creates an embedding vector representing the input text. diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 79d387d0f..3dc98bab0 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -27,6 +27,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagin import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; +/** + * Manage and run evals in the OpenAI platform. + */ export class Evals extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); diff --git a/src/resources/evals/runs/output-items.ts b/src/resources/evals/runs/output-items.ts index 16a8956b4..c5510ebdb 100644 --- a/src/resources/evals/runs/output-items.ts +++ b/src/resources/evals/runs/output-items.ts @@ -7,6 +7,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pa import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +/** + * Manage and run evals in the OpenAI platform. + */ export class OutputItems extends APIResource { /** * Get an evaluation run output item by ID. diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 941b6b5df..0d24bc606 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -19,6 +19,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pa import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +/** + * Manage and run evals in the OpenAI platform. + */ export class Runs extends APIResource { outputItems: OutputItemsAPI.OutputItems = new OutputItemsAPI.OutputItems(this._client); diff --git a/src/resources/files.ts b/src/resources/files.ts index 7a8391316..3f74fe374 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -11,6 +11,9 @@ import { APIConnectionTimeoutError } from '../error'; import { multipartFormRequestOptions } from '../internal/uploads'; import { path } from '../internal/utils/path'; +/** + * Files are used to upload documents that can be used with features like Assistants and Fine-tuning. + */ export class Files extends APIResource { /** * Upload a file that can be used across various endpoints. Individual files can be diff --git a/src/resources/fine-tuning/alpha/graders.ts b/src/resources/fine-tuning/alpha/graders.ts index 273c7117e..fa150f4e0 100644 --- a/src/resources/fine-tuning/alpha/graders.ts +++ b/src/resources/fine-tuning/alpha/graders.ts @@ -5,6 +5,9 @@ import * as GraderModelsAPI from '../../graders/grader-models'; import { APIPromise } from '../../../core/api-promise'; import { RequestOptions } from '../../../internal/request-options'; +/** + * Manage fine-tuning jobs to tailor a model to your specific training data. + */ export class Graders extends APIResource { /** * Run a grader. diff --git a/src/resources/fine-tuning/checkpoints/checkpoints.ts b/src/resources/fine-tuning/checkpoints/checkpoints.ts index da055b0e4..0ce07d032 100644 --- a/src/resources/fine-tuning/checkpoints/checkpoints.ts +++ b/src/resources/fine-tuning/checkpoints/checkpoints.ts @@ -8,6 +8,9 @@ import { PermissionCreateResponsesPage, PermissionDeleteParams, PermissionDeleteResponse, + PermissionListParams, + PermissionListResponse, + PermissionListResponsesPage, PermissionRetrieveParams, PermissionRetrieveResponse, Permissions, @@ -24,10 +27,13 @@ export declare namespace Checkpoints { Permissions as Permissions, type PermissionCreateResponse as PermissionCreateResponse, type PermissionRetrieveResponse as PermissionRetrieveResponse, + type PermissionListResponse as PermissionListResponse, type PermissionDeleteResponse as PermissionDeleteResponse, type PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionListResponsesPage as PermissionListResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, + type PermissionListParams as PermissionListParams, type PermissionDeleteParams as PermissionDeleteParams, }; } diff --git a/src/resources/fine-tuning/checkpoints/index.ts b/src/resources/fine-tuning/checkpoints/index.ts index 7e04fc667..d39cd717e 100644 --- a/src/resources/fine-tuning/checkpoints/index.ts +++ b/src/resources/fine-tuning/checkpoints/index.ts @@ -5,9 +5,12 @@ export { Permissions, type PermissionCreateResponse, type PermissionRetrieveResponse, + type PermissionListResponse, type PermissionDeleteResponse, type PermissionCreateParams, type PermissionRetrieveParams, + type PermissionListParams, type PermissionDeleteParams, type PermissionCreateResponsesPage, + type PermissionListResponsesPage, } from './permissions'; diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts index 9217f324c..72159aed4 100644 --- a/src/resources/fine-tuning/checkpoints/permissions.ts +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -2,10 +2,18 @@ import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; -import { Page, PagePromise } from '../../../core/pagination'; +import { + ConversationCursorPage, + type ConversationCursorPageParams, + Page, + PagePromise, +} from '../../../core/pagination'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +/** + * Manage fine-tuning jobs to tailor a model to your specific training data. + */ export class Permissions extends APIResource { /** * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys). @@ -42,13 +50,7 @@ export class Permissions extends APIResource { * Organization owners can use this endpoint to view all permissions for a * fine-tuned model checkpoint. * - * @example - * ```ts - * const permission = - * await client.fineTuning.checkpoints.permissions.retrieve( - * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', - * ); - * ``` + * @deprecated Retrieve is deprecated. Please swap to the paginated list method instead. */ retrieve( fineTunedModelCheckpoint: string, @@ -61,6 +63,34 @@ export class Permissions extends APIResource { }); } + /** + * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + * + * Organization owners can use this endpoint to view all permissions for a + * fine-tuned model checkpoint. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const permissionListResponse of client.fineTuning.checkpoints.permissions.list( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * )) { + * // ... + * } + * ``` + */ + list( + fineTunedModelCheckpoint: string, + query: PermissionListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList( + path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, + ConversationCursorPage, + { query, ...options }, + ); + } + /** * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). * @@ -95,6 +125,8 @@ export class Permissions extends APIResource { // Note: no pagination actually occurs yet, this is for forwards-compatibility. export type PermissionCreateResponsesPage = Page; +export type PermissionListResponsesPage = ConversationCursorPage; + /** * The `checkpoint.permission` object represents a permission for a fine-tuned * model checkpoint. @@ -161,6 +193,32 @@ export namespace PermissionRetrieveResponse { } } +/** + * The `checkpoint.permission` object represents a permission for a fine-tuned + * model checkpoint. + */ +export interface PermissionListResponse { + /** + * The permission identifier, which can be referenced in the API endpoints. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the permission was created. + */ + created_at: number; + + /** + * The object type, which is always "checkpoint.permission". + */ + object: 'checkpoint.permission'; + + /** + * The project identifier that the permission is for. + */ + project_id: string; +} + export interface PermissionDeleteResponse { /** * The ID of the fine-tuned model checkpoint permission that was deleted. @@ -207,6 +265,18 @@ export interface PermissionRetrieveParams { project_id?: string; } +export interface PermissionListParams extends ConversationCursorPageParams { + /** + * The order in which to retrieve permissions. + */ + order?: 'ascending' | 'descending'; + + /** + * The ID of the project to get permissions for. + */ + project_id?: string; +} + export interface PermissionDeleteParams { /** * The ID of the fine-tuned model checkpoint to delete a permission for. @@ -218,10 +288,13 @@ export declare namespace Permissions { export { type PermissionCreateResponse as PermissionCreateResponse, type PermissionRetrieveResponse as PermissionRetrieveResponse, + type PermissionListResponse as PermissionListResponse, type PermissionDeleteResponse as PermissionDeleteResponse, type PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionListResponsesPage as PermissionListResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, + type PermissionListParams as PermissionListParams, type PermissionDeleteParams as PermissionDeleteParams, }; } diff --git a/src/resources/fine-tuning/jobs/checkpoints.ts b/src/resources/fine-tuning/jobs/checkpoints.ts index 868713b6d..bfeffed0c 100644 --- a/src/resources/fine-tuning/jobs/checkpoints.ts +++ b/src/resources/fine-tuning/jobs/checkpoints.ts @@ -5,6 +5,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pa import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +/** + * Manage fine-tuning jobs to tailor a model to your specific training data. + */ export class Checkpoints extends APIResource { /** * List checkpoints for a fine-tuning job. diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 91935a496..868e307fc 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -15,6 +15,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pa import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +/** + * Manage fine-tuning jobs to tailor a model to your specific training data. + */ export class Jobs extends APIResource { checkpoints: CheckpointsAPI.Checkpoints = new CheckpointsAPI.Checkpoints(this._client); diff --git a/src/resources/images.ts b/src/resources/images.ts index d72a51220..77987bc7b 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -8,6 +8,9 @@ import { type Uploadable } from '../core/uploads'; import { RequestOptions } from '../internal/request-options'; import { multipartFormRequestOptions } from '../internal/uploads'; +/** + * Given a prompt and/or an input image, the model will generate a new image. + */ export class Images extends APIResource { /** * Creates a variation of a given image. This endpoint only supports `dall-e-2`. diff --git a/src/resources/models.ts b/src/resources/models.ts index 25a730ebf..138566284 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -6,6 +6,9 @@ import { Page, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; +/** + * List and describe the various models available in the API. + */ export class Models extends APIResource { /** * Retrieves a model instance, providing basic information about the model such as diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index 2792e0f30..26f75002c 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -4,6 +4,9 @@ import { APIResource } from '../core/resource'; import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; +/** + * Given text and/or image inputs, classifies if those inputs are potentially harmful. + */ export class Moderations extends APIResource { /** * Classifies if text and/or image inputs are potentially harmful. Learn more in diff --git a/src/resources/realtime/client-secrets.ts b/src/resources/realtime/client-secrets.ts index 6bfa233eb..1050bb776 100644 --- a/src/resources/realtime/client-secrets.ts +++ b/src/resources/realtime/client-secrets.ts @@ -451,6 +451,11 @@ export namespace RealtimeSessionCreateResponse { | 'connector_outlookemail' | 'connector_sharepoint'; + /** + * Whether this MCP tool is deferred and discovered via tool search. + */ + defer_loading?: boolean; + /** * Optional HTTP headers to send to the MCP server. Use for authentication or other * purposes. diff --git a/src/resources/realtime/realtime.ts b/src/resources/realtime/realtime.ts index 1254aa723..a33e6d7bc 100644 --- a/src/resources/realtime/realtime.ts +++ b/src/resources/realtime/realtime.ts @@ -2200,6 +2200,11 @@ export interface RealtimeResponseCreateMcpTool { | 'connector_outlookemail' | 'connector_sharepoint'; + /** + * Whether this MCP tool is deferred and discovered via tool search. + */ + defer_loading?: boolean; + /** * Optional HTTP headers to send to the MCP server. Use for authentication or other * purposes. @@ -3209,6 +3214,11 @@ export namespace RealtimeToolsConfigUnion { | 'connector_outlookemail' | 'connector_sharepoint'; + /** + * Whether this MCP tool is deferred and discovered via tool search. + */ + defer_loading?: boolean; + /** * Optional HTTP headers to send to the MCP server. Use for authentication or other * purposes. diff --git a/src/resources/responses/api.md b/src/resources/responses/api.md index 63e864169..c5edb6c08 100644 --- a/src/resources/responses/api.md +++ b/src/resources/responses/api.md @@ -4,7 +4,10 @@ Types: - ApplyPatchTool - CompactedResponse +- ComputerAction +- ComputerActionList - ComputerTool +- ComputerUseTool - ContainerAuto - ContainerNetworkPolicyAllowlist - ContainerNetworkPolicyDisabled @@ -19,6 +22,7 @@ Types: - InlineSkillSource - LocalEnvironment - LocalSkill +- NamespaceTool - Response - ResponseApplyPatchToolCall - ResponseApplyPatchToolCallOutput @@ -121,6 +125,9 @@ Types: - ResponseTextConfig - ResponseTextDeltaEvent - ResponseTextDoneEvent +- ResponseToolSearchCall +- ResponseToolSearchOutputItem +- ResponseToolSearchOutputItemParam - ResponseUsage - ResponseWebSearchCallCompletedEvent - ResponseWebSearchCallInProgressEvent @@ -137,6 +144,7 @@ Types: - ToolChoiceOptions - ToolChoiceShell - ToolChoiceTypes +- ToolSearchTool - WebSearchPreviewTool - WebSearchTool diff --git a/src/resources/responses/internal-base.ts b/src/resources/responses/internal-base.ts index 30417aeb0..c03e180e6 100644 --- a/src/resources/responses/internal-base.ts +++ b/src/resources/responses/internal-base.ts @@ -5,6 +5,7 @@ import { OpenAI } from '../../client'; import { EventEmitter } from '../../core/EventEmitter'; import { OpenAIError } from '../../core/error'; +import { stringifyQuery } from '../../internal/utils'; export class WebSocketError extends OpenAIError { /** @@ -72,10 +73,13 @@ export abstract class ResponsesEmitter extends EventEmitter { } } -export function buildURL(client: OpenAI): URL { +export function buildURL(client: OpenAI, query?: object | null): URL { const path = '/responses'; const baseURL = client.baseURL; const url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path)); + if (query) { + url.search = stringifyQuery(query); + } url.protocol = 'wss'; return url; } diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index b0f91f131..719d5f581 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -41,6 +41,8 @@ export type ParsedResponseOutputItem = | ResponseFileSearchToolCall | ResponseFunctionWebSearch | ResponseComputerToolCall + | ResponseToolSearchCall + | ResponseToolSearchOutputItem | ResponseReasoningItem | ResponseCompactionItem | ResponseOutputItem.ImageGenerationCall @@ -219,7 +221,7 @@ export class Responses extends APIResource { * @example * ```ts * const compactedResponse = await client.responses.compact({ - * model: 'gpt-5.2', + * model: 'gpt-5.4', * }); * ``` */ @@ -269,6 +271,223 @@ export interface CompactedResponse { usage: ResponseUsage; } +/** + * A click action. + */ +export type ComputerAction = + | ComputerAction.Click + | ComputerAction.DoubleClick + | ComputerAction.Drag + | ComputerAction.Keypress + | ComputerAction.Move + | ComputerAction.Screenshot + | ComputerAction.Scroll + | ComputerAction.Type + | ComputerAction.Wait; + +export namespace ComputerAction { + /** + * A click action. + */ + export interface Click { + /** + * Indicates which mouse button was pressed during the click. One of `left`, + * `right`, `wheel`, `back`, or `forward`. + */ + button: 'left' | 'right' | 'wheel' | 'back' | 'forward'; + + /** + * Specifies the event type. For a click action, this property is always `click`. + */ + type: 'click'; + + /** + * The x-coordinate where the click occurred. + */ + x: number; + + /** + * The y-coordinate where the click occurred. + */ + y: number; + } + + /** + * A double click action. + */ + export interface DoubleClick { + /** + * Specifies the event type. For a double click action, this property is always set + * to `double_click`. + */ + type: 'double_click'; + + /** + * The x-coordinate where the double click occurred. + */ + x: number; + + /** + * The y-coordinate where the double click occurred. + */ + y: number; + } + + /** + * A drag action. + */ + export interface Drag { + /** + * An array of coordinates representing the path of the drag action. Coordinates + * will appear as an array of objects, eg + * + * ``` + * [ + * { x: 100, y: 200 }, + * { x: 200, y: 300 } + * ] + * ``` + */ + path: Array; + + /** + * Specifies the event type. For a drag action, this property is always set to + * `drag`. + */ + type: 'drag'; + } + + export namespace Drag { + /** + * An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`. + */ + export interface Path { + /** + * The x-coordinate. + */ + x: number; + + /** + * The y-coordinate. + */ + y: number; + } + } + + /** + * A collection of keypresses the model would like to perform. + */ + export interface Keypress { + /** + * The combination of keys the model is requesting to be pressed. This is an array + * of strings, each representing a key. + */ + keys: Array; + + /** + * Specifies the event type. For a keypress action, this property is always set to + * `keypress`. + */ + type: 'keypress'; + } + + /** + * A mouse move action. + */ + export interface Move { + /** + * Specifies the event type. For a move action, this property is always set to + * `move`. + */ + type: 'move'; + + /** + * The x-coordinate to move to. + */ + x: number; + + /** + * The y-coordinate to move to. + */ + y: number; + } + + /** + * A screenshot action. + */ + export interface Screenshot { + /** + * Specifies the event type. For a screenshot action, this property is always set + * to `screenshot`. + */ + type: 'screenshot'; + } + + /** + * A scroll action. + */ + export interface Scroll { + /** + * The horizontal scroll distance. + */ + scroll_x: number; + + /** + * The vertical scroll distance. + */ + scroll_y: number; + + /** + * Specifies the event type. For a scroll action, this property is always set to + * `scroll`. + */ + type: 'scroll'; + + /** + * The x-coordinate where the scroll occurred. + */ + x: number; + + /** + * The y-coordinate where the scroll occurred. + */ + y: number; + } + + /** + * An action to type in text. + */ + export interface Type { + /** + * The text to type. + */ + text: string; + + /** + * Specifies the event type. For a type action, this property is always set to + * `type`. + */ + type: 'type'; + } + + /** + * A wait action. + */ + export interface Wait { + /** + * Specifies the event type. For a wait action, this property is always set to + * `wait`. + */ + type: 'wait'; + } +} + +/** + * Flattened batched actions for `computer_use`. Each action includes an `type` + * discriminator and action-specific fields. + */ +export type ComputerActionList = Array; + /** * A tool that controls a virtual computer. Learn more about the * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). @@ -295,6 +514,17 @@ export interface ComputerTool { type: 'computer_use_preview'; } +/** + * A tool that controls a virtual computer. Learn more about the + * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). + */ +export interface ComputerUseTool { + /** + * The type of the computer tool. Always `computer`. + */ + type: 'computer'; +} + export interface ContainerAuto { /** * Automatically creates a container for this request @@ -390,6 +620,11 @@ export interface CustomTool { */ type: 'custom'; + /** + * Whether this tool should be deferred and discovered via tool search. + */ + defer_loading?: boolean; + /** * Optional description of the custom tool, used to provide more context. */ @@ -422,12 +657,10 @@ export interface EasyInputMessage { role: 'user' | 'assistant' | 'system' | 'developer'; /** - * The phase of an assistant message. - * - * Use `commentary` for an intermediate assistant message and `final_answer` for - * the final assistant message. For follow-up requests with models like - * `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. - * Omitting it can degrade performance. Not used for user messages. + * Labels an `assistant` message as intermediate commentary (`commentary`) or the + * final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when + * sending follow-up requests, preserve and resend phase on all assistant messages + * — dropping it can degrade performance. Not used for user messages. */ phase?: 'commentary' | 'final_answer' | null; @@ -551,6 +784,11 @@ export interface FunctionTool { */ type: 'function'; + /** + * Whether this function is deferred and loaded via tool search. + */ + defer_loading?: boolean; + /** * A description of the function. Used by the model to determine whether or not to * call the function. @@ -629,6 +867,45 @@ export interface LocalSkill { path: string; } +/** + * Groups function/custom tools under a shared namespace. + */ +export interface NamespaceTool { + /** + * A description of the namespace shown to the model. + */ + description: string; + + /** + * The namespace name used in tool calls (for example, `crm`). + */ + name: string; + + /** + * The function/custom tools available inside this namespace. + */ + tools: Array; + + /** + * The type of the tool. Always `namespace`. + */ + type: 'namespace'; +} + +export namespace NamespaceTool { + export interface Function { + name: string; + + type: 'function'; + + description?: string | null; + + parameters?: unknown | null; + + strict?: boolean | null; + } +} + export interface Response { /** * Unique identifier for this Response. @@ -1402,20 +1679,6 @@ export interface ResponseComputerToolCall { */ id: string; - /** - * A click action. - */ - action: - | ResponseComputerToolCall.Click - | ResponseComputerToolCall.DoubleClick - | ResponseComputerToolCall.Drag - | ResponseComputerToolCall.Keypress - | ResponseComputerToolCall.Move - | ResponseComputerToolCall.Screenshot - | ResponseComputerToolCall.Scroll - | ResponseComputerToolCall.Type - | ResponseComputerToolCall.Wait; - /** * An identifier used when responding to the tool call with output. */ @@ -1436,9 +1699,49 @@ export interface ResponseComputerToolCall { * The type of the computer call. Always `computer_call`. */ type: 'computer_call'; + + /** + * A click action. + */ + action?: + | ResponseComputerToolCall.Click + | ResponseComputerToolCall.DoubleClick + | ResponseComputerToolCall.Drag + | ResponseComputerToolCall.Keypress + | ResponseComputerToolCall.Move + | ResponseComputerToolCall.Screenshot + | ResponseComputerToolCall.Scroll + | ResponseComputerToolCall.Type + | ResponseComputerToolCall.Wait; + + /** + * Flattened batched actions for `computer_use`. Each action includes an `type` + * discriminator and action-specific fields. + */ + actions?: ComputerActionList; } export namespace ResponseComputerToolCall { + /** + * A pending safety check for the computer call. + */ + export interface PendingSafetyCheck { + /** + * The ID of the pending safety check. + */ + id: string; + + /** + * The type of the pending safety check. + */ + code?: string | null; + + /** + * Details about the pending safety check. + */ + message?: string | null; + } + /** * A click action. */ @@ -1633,26 +1936,6 @@ export namespace ResponseComputerToolCall { */ type: 'wait'; } - - /** - * A pending safety check for the computer call. - */ - export interface PendingSafetyCheck { - /** - * The ID of the pending safety check. - */ - id: string; - - /** - * The type of the pending safety check. - */ - code?: string | null; - - /** - * Details about the pending safety check. - */ - message?: string | null; - } } export interface ResponseComputerToolCallOutputItem { @@ -1934,6 +2217,11 @@ export interface ResponseCustomToolCall { * The unique ID of the custom tool call in the OpenAI platform. */ id?: string; + + /** + * The namespace of the custom tool being called. + */ + namespace?: string; } /** @@ -2617,6 +2905,11 @@ export interface ResponseFunctionToolCall { */ id?: string; + /** + * The namespace of the function to run. + */ + namespace?: string; + /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. @@ -3007,6 +3300,12 @@ export interface ResponseInputFile { */ type: 'input_file'; + /** + * The detail level of the file to be sent to the model. One of `high` or `low`. + * Defaults to `high`. + */ + detail?: 'low' | 'high'; + /** * The content of the file to be sent to the model. */ @@ -3037,6 +3336,12 @@ export interface ResponseInputFileContent { */ type: 'input_file'; + /** + * The detail level of the file to be sent to the model. One of `high` or `low`. + * Defaults to `high`. + */ + detail?: 'high' | 'low'; + /** * The base64-encoded data of the file to be sent to the model. */ @@ -3064,10 +3369,10 @@ export interface ResponseInputFileContent { */ export interface ResponseInputImage { /** - * The detail level of the image to be sent to the model. One of `high`, `low`, or - * `auto`. Defaults to `auto`. + * The detail level of the image to be sent to the model. One of `high`, `low`, + * `auto`, or `original`. Defaults to `auto`. */ - detail: 'low' | 'high' | 'auto'; + detail: 'low' | 'high' | 'auto' | 'original'; /** * The type of the input item. Always `input_image`. @@ -3097,10 +3402,10 @@ export interface ResponseInputImageContent { type: 'input_image'; /** - * The detail level of the image to be sent to the model. One of `high`, `low`, or - * `auto`. Defaults to `auto`. + * The detail level of the image to be sent to the model. One of `high`, `low`, + * `auto`, or `original`. Defaults to `auto`. */ - detail?: 'low' | 'high' | 'auto' | null; + detail?: 'low' | 'high' | 'auto' | 'original' | null; /** * The ID of the file to be sent to the model. @@ -3131,6 +3436,8 @@ export type ResponseInputItem = | ResponseFunctionWebSearch | ResponseFunctionToolCall | ResponseInputItem.FunctionCallOutput + | ResponseInputItem.ToolSearchCall + | ResponseToolSearchOutputItemParam | ResponseReasoningItem | ResponseCompactionItemParam | ResponseInputItem.ImageGenerationCall @@ -3270,6 +3577,38 @@ export namespace ResponseInputItem { status?: 'in_progress' | 'completed' | 'incomplete' | null; } + export interface ToolSearchCall { + /** + * The arguments supplied to the tool search call. + */ + arguments: unknown; + + /** + * The item type. Always `tool_search_call`. + */ + type: 'tool_search_call'; + + /** + * The unique ID of this tool search call. + */ + id?: string | null; + + /** + * The unique ID of the tool search call generated by the model. + */ + call_id?: string | null; + + /** + * Whether tool search was executed by the server or by the client. + */ + execution?: 'server' | 'client'; + + /** + * The status of the tool search call. + */ + status?: 'in_progress' | 'completed' | 'incomplete' | null; + } + /** * An image generation request made by the model. */ @@ -3870,6 +4209,8 @@ export type ResponseItem = | ResponseFunctionWebSearch | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem + | ResponseToolSearchCall + | ResponseToolSearchOutputItem | ResponseItem.ImageGenerationCall | ResponseCodeInterpreterToolCall | ResponseItem.LocalShellCall @@ -4425,6 +4766,8 @@ export type ResponseOutputItem = | ResponseFunctionWebSearch | ResponseComputerToolCall | ResponseReasoningItem + | ResponseToolSearchCall + | ResponseToolSearchOutputItem | ResponseCompactionItem | ResponseOutputItem.ImageGenerationCall | ResponseCodeInterpreterToolCall @@ -4753,12 +5096,10 @@ export interface ResponseOutputMessage { type: 'message'; /** - * The phase of an assistant message. - * - * Use `commentary` for an intermediate assistant message and `final_answer` for - * the final assistant message. For follow-up requests with models like - * `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. - * Omitting it can degrade performance. Not used for user messages. + * Labels an `assistant` message as intermediate commentary (`commentary`) or the + * final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when + * sending follow-up requests, preserve and resend phase on all assistant messages + * — dropping it can degrade performance. Not used for user messages. */ phase?: 'commentary' | 'final_answer' | null; } @@ -5665,6 +6006,112 @@ export namespace ResponseTextDoneEvent { } } +export interface ResponseToolSearchCall { + /** + * The unique ID of the tool search call item. + */ + id: string; + + /** + * Arguments used for the tool search call. + */ + arguments: unknown; + + /** + * The unique ID of the tool search call generated by the model. + */ + call_id: string | null; + + /** + * Whether tool search was executed by the server or by the client. + */ + execution: 'server' | 'client'; + + /** + * The status of the tool search call item that was recorded. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the item. Always `tool_search_call`. + */ + type: 'tool_search_call'; + + /** + * The identifier of the actor that created the item. + */ + created_by?: string; +} + +export interface ResponseToolSearchOutputItem { + /** + * The unique ID of the tool search output item. + */ + id: string; + + /** + * The unique ID of the tool search call generated by the model. + */ + call_id: string | null; + + /** + * Whether tool search was executed by the server or by the client. + */ + execution: 'server' | 'client'; + + /** + * The status of the tool search output item that was recorded. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The loaded tool definitions returned by tool search. + */ + tools: Array; + + /** + * The type of the item. Always `tool_search_output`. + */ + type: 'tool_search_output'; + + /** + * The identifier of the actor that created the item. + */ + created_by?: string; +} + +export interface ResponseToolSearchOutputItemParam { + /** + * The loaded tool definitions returned by the tool search output. + */ + tools: Array; + + /** + * The item type. Always `tool_search_output`. + */ + type: 'tool_search_output'; + + /** + * The unique ID of this tool search output. + */ + id?: string | null; + + /** + * The unique ID of the tool search call generated by the model. + */ + call_id?: string | null; + + /** + * Whether tool search was executed by the server or by the client. + */ + execution?: 'server' | 'client'; + + /** + * The status of the tool search output. + */ + status?: 'in_progress' | 'completed' | 'incomplete' | null; +} + /** * Represents token usage details including input tokens, output tokens, a * breakdown of output tokens, and the total tokens used. @@ -6191,6 +6638,7 @@ export interface SkillReference { export type Tool = | FunctionTool | FileSearchTool + | ComputerUseTool | ComputerTool | WebSearchTool | Tool.Mcp @@ -6199,6 +6647,8 @@ export type Tool = | Tool.LocalShell | FunctionShellTool | CustomTool + | NamespaceTool + | ToolSearchTool | WebSearchPreviewTool | ApplyPatchTool; @@ -6258,6 +6708,11 @@ export namespace Tool { | 'connector_outlookemail' | 'connector_sharepoint'; + /** + * Whether this MCP tool is deferred and discovered via tool search. + */ + defer_loading?: boolean; + /** * Optional HTTP headers to send to the MCP server. Use for authentication or other * purposes. @@ -6636,7 +7091,9 @@ export interface ToolChoiceTypes { * * - `file_search` * - `web_search_preview` + * - `computer` * - `computer_use_preview` + * - `computer_use` * - `code_interpreter` * - `mcp` * - `image_generation` @@ -6644,13 +7101,40 @@ export interface ToolChoiceTypes { type: | 'file_search' | 'web_search_preview' + | 'computer' | 'computer_use_preview' + | 'computer_use' | 'web_search_preview_2025_03_11' | 'image_generation' | 'code_interpreter' | 'mcp'; } +/** + * Hosted or BYOT tool search configuration for deferred tools. + */ +export interface ToolSearchTool { + /** + * The type of the tool. Always `tool_search`. + */ + type: 'tool_search'; + + /** + * Description shown to the model for a client-executed tool search tool. + */ + description?: string | null; + + /** + * Whether tool search is executed by the server or by the client. + */ + execution?: 'server' | 'client'; + + /** + * Parameter schema for a client-executed tool search tool. + */ + parameters?: unknown | null; +} + /** * This tool searches the web for relevant results to use in a response. Learn more * about the @@ -6663,6 +7147,8 @@ export interface WebSearchPreviewTool { */ type: 'web_search_preview' | 'web_search_preview_2025_03_11'; + search_content_types?: Array<'text' | 'image'>; + /** * High level guidance for the amount of context window space to use for the * search. One of `low`, `medium`, or `high`. `medium` is the default. @@ -7184,6 +7670,8 @@ export interface ResponseCompactParams { * available models. */ model: + | 'gpt-5.4' + | 'gpt-5.3-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' @@ -7307,7 +7795,10 @@ export declare namespace Responses { export { type ApplyPatchTool as ApplyPatchTool, type CompactedResponse as CompactedResponse, + type ComputerAction as ComputerAction, + type ComputerActionList as ComputerActionList, type ComputerTool as ComputerTool, + type ComputerUseTool as ComputerUseTool, type ContainerAuto as ContainerAuto, type ContainerNetworkPolicyAllowlist as ContainerNetworkPolicyAllowlist, type ContainerNetworkPolicyDisabled as ContainerNetworkPolicyDisabled, @@ -7322,6 +7813,7 @@ export declare namespace Responses { type InlineSkillSource as InlineSkillSource, type LocalEnvironment as LocalEnvironment, type LocalSkill as LocalSkill, + type NamespaceTool as NamespaceTool, type Response as Response, type ResponseApplyPatchToolCall as ResponseApplyPatchToolCall, type ResponseApplyPatchToolCallOutput as ResponseApplyPatchToolCallOutput, @@ -7424,6 +7916,9 @@ export declare namespace Responses { type ResponseTextConfig as ResponseTextConfig, type ResponseTextDeltaEvent as ResponseTextDeltaEvent, type ResponseTextDoneEvent as ResponseTextDoneEvent, + type ResponseToolSearchCall as ResponseToolSearchCall, + type ResponseToolSearchOutputItem as ResponseToolSearchOutputItem, + type ResponseToolSearchOutputItemParam as ResponseToolSearchOutputItemParam, type ResponseUsage as ResponseUsage, type ResponseWebSearchCallCompletedEvent as ResponseWebSearchCallCompletedEvent, type ResponseWebSearchCallInProgressEvent as ResponseWebSearchCallInProgressEvent, @@ -7440,6 +7935,7 @@ export declare namespace Responses { type ToolChoiceOptions as ToolChoiceOptions, type ToolChoiceShell as ToolChoiceShell, type ToolChoiceTypes as ToolChoiceTypes, + type ToolSearchTool as ToolSearchTool, type WebSearchPreviewTool as WebSearchPreviewTool, type WebSearchTool as WebSearchTool, type ResponseCreateParams as ResponseCreateParams, diff --git a/src/resources/responses/ws.ts b/src/resources/responses/ws.ts index ac199d43c..3ca11d28c 100644 --- a/src/resources/responses/ws.ts +++ b/src/resources/responses/ws.ts @@ -10,10 +10,10 @@ export class ResponsesWS extends ResponsesEmitter { socket: WS.WebSocket; private client: OpenAI; - constructor(client: OpenAI, options?: WS.ClientOptions | undefined) { + constructor(client: OpenAI, options?: WS.ClientOptions | null | undefined) { super(); this.client = client; - this.url = buildURL(client); + this.url = buildURL(client, {}); this.socket = new WS.WebSocket(this.url, { ...options, headers: { diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 9775d2d89..1cb4f9f80 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -19,6 +19,8 @@ export type AllModels = | 'gpt-5.1-codex-max'; export type ChatModel = + | 'gpt-5.4' + | 'gpt-5.3-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' diff --git a/src/resources/uploads/parts.ts b/src/resources/uploads/parts.ts index 4e3509f9f..15bb049b7 100644 --- a/src/resources/uploads/parts.ts +++ b/src/resources/uploads/parts.ts @@ -7,6 +7,9 @@ import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; import { path } from '../../internal/utils/path'; +/** + * Use Uploads to upload large files in multiple parts. + */ export class Parts extends APIResource { /** * Adds a diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index 3af4bcc40..ec05b41c1 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -8,6 +8,9 @@ import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; +/** + * Use Uploads to upload large files in multiple parts. + */ export class Uploads extends APIResource { parts: PartsAPI.Parts = new PartsAPI.Parts(this._client); diff --git a/src/resources/videos.ts b/src/resources/videos.ts index a7d299baa..3a147ee3e 100644 --- a/src/resources/videos.ts +++ b/src/resources/videos.ts @@ -127,9 +127,10 @@ export interface Video { remixed_from_video_id: string | null; /** - * Duration of the generated clip in seconds. + * Duration of the generated clip in seconds. For extensions, this is the stitched + * total duration. */ - seconds: VideoSeconds; + seconds: (string & {}) | VideoSeconds; /** * The resolution of the generated video. @@ -196,7 +197,7 @@ export interface VideoCreateParams { prompt: string; /** - * Optional image reference that guides generation. + * Optional multipart reference asset that guides generation. */ input_reference?: Uploadable; diff --git a/src/version.ts b/src/version.ts index e7cc4397b..63331bd50 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '6.25.0'; // x-release-please-version +export const VERSION = '6.26.0'; // x-release-please-version diff --git a/tests/api-resources/chat/completions/completions.test.ts b/tests/api-resources/chat/completions/completions.test.ts index d8ab7e6fc..070a50313 100644 --- a/tests/api-resources/chat/completions/completions.test.ts +++ b/tests/api-resources/chat/completions/completions.test.ts @@ -11,7 +11,7 @@ describe('resource completions', () => { test('create: only required params', async () => { const responsePromise = client.chat.completions.create({ messages: [{ content: 'string', role: 'developer' }], - model: 'gpt-4o', + model: 'gpt-5.4', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -31,7 +31,7 @@ describe('resource completions', () => { name: 'name', }, ], - model: 'gpt-4o', + model: 'gpt-5.4', audio: { format: 'wav', voice: 'ash' }, frequency_penalty: -2, function_call: 'none', diff --git a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts index cdeca2d2b..cafea0d01 100644 --- a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts +++ b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts @@ -56,6 +56,33 @@ describe('resource permissions', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); + test('list', async () => { + const responsePromise = client.fineTuning.checkpoints.permissions.list('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.fineTuning.checkpoints.permissions.list( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + { + after: 'after', + limit: 0, + order: 'ascending', + project_id: 'project_id', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + test('delete: only required params', async () => { const responsePromise = client.fineTuning.checkpoints.permissions.delete('cp_zc4Q7MP6XxulcVzj4MZdwsAB', { fine_tuned_model_checkpoint: 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', diff --git a/tests/api-resources/responses/input-tokens.test.ts b/tests/api-resources/responses/input-tokens.test.ts index 2879f3c5d..bd0f2e0a4 100644 --- a/tests/api-resources/responses/input-tokens.test.ts +++ b/tests/api-resources/responses/input-tokens.test.ts @@ -46,6 +46,7 @@ describe('resource inputTokens', () => { parameters: { foo: 'bar' }, strict: true, type: 'function', + defer_loading: true, description: 'description', }, ], diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index 3046c451a..8db058e6e 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -75,7 +75,7 @@ describe('resource responses', () => { }); test('compact: only required params', async () => { - const responsePromise = client.responses.compact({ model: 'gpt-5.2' }); + const responsePromise = client.responses.compact({ model: 'gpt-5.4' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -87,7 +87,7 @@ describe('resource responses', () => { test('compact: required and optional params', async () => { const response = await client.responses.compact({ - model: 'gpt-5.2', + model: 'gpt-5.4', input: 'string', instructions: 'instructions', previous_response_id: 'resp_123', diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts index e5f3e560a..3566278e5 100644 --- a/tests/stringifyQuery.test.ts +++ b/tests/stringifyQuery.test.ts @@ -1,8 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { OpenAI } from 'openai'; - -const { stringifyQuery } = OpenAI.prototype as any; +import { stringifyQuery } from 'openai/internal/utils/query'; describe(stringifyQuery, () => { for (const [input, expected] of [ @@ -15,7 +13,7 @@ describe(stringifyQuery, () => { 'e=f', )}=${encodeURIComponent('g&h')}`, ], - ]) { + ] as const) { it(`${JSON.stringify(input)} -> ${expected}`, () => { expect(stringifyQuery(input)).toEqual(expected); });