diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de35570a8..b2ee58e08 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.81.0" + ".": "4.82.0" } diff --git a/.stats.yml b/.stats.yml index d518bac58..e49b5c56e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 69 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-3904ef6b29a89c98f93a9b7da19879695f3c440564be6384db7af1b734611ede.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-6204952a29973265b9c0d66fc67ffaf53c6a90ae4d75cdacf9d147676f5274c9.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index b24c0869d..7565cb01a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.82.0 (2025-01-31) + +Full Changelog: [v4.81.0...v4.82.0](https://github.com/openai/openai-node/compare/v4.81.0...v4.82.0) + +### Features + +* **api:** add o3-mini ([#1295](https://github.com/openai/openai-node/issues/1295)) ([378e2f7](https://github.com/openai/openai-node/commit/378e2f7af62c570adb4c7644a4d49576b698de41)) + + +### Bug Fixes + +* **examples/realtime:** remove duplicate `session.update` call ([#1293](https://github.com/openai/openai-node/issues/1293)) ([ad800b4](https://github.com/openai/openai-node/commit/ad800b4f9410c6838994c24a3386ea708717f72b)) +* **types:** correct metadata type + other fixes ([378e2f7](https://github.com/openai/openai-node/commit/378e2f7af62c570adb4c7644a4d49576b698de41)) + ## 4.81.0 (2025-01-29) Full Changelog: [v4.80.1...v4.81.0](https://github.com/openai/openai-node/compare/v4.80.1...v4.81.0) diff --git a/api.md b/api.md index 33ab95ef6..516188b20 100644 --- a/api.md +++ b/api.md @@ -5,6 +5,7 @@ Types: - ErrorObject - FunctionDefinition - FunctionParameters +- Metadata - ResponseFormatJSONObject - ResponseFormatJSONSchema - ResponseFormatText diff --git a/examples/azure/realtime/ws.ts b/examples/azure/realtime/ws.ts index ae20a1438..6ab7b742a 100644 --- a/examples/azure/realtime/ws.ts +++ b/examples/azure/realtime/ws.ts @@ -25,13 +25,6 @@ async function main() { model: 'gpt-4o-realtime-preview', }, }); - rt.send({ - type: 'session.update', - session: { - modalities: ['text'], - model: 'gpt-4o-realtime-preview', - }, - }); rt.send({ type: 'conversation.item.create', diff --git a/examples/realtime/ws.ts b/examples/realtime/ws.ts index bba140800..08c6fbcb6 100644 --- a/examples/realtime/ws.ts +++ b/examples/realtime/ws.ts @@ -13,13 +13,6 @@ async function main() { model: 'gpt-4o-realtime-preview', }, }); - rt.send({ - type: 'session.update', - session: { - modalities: ['text'], - model: 'gpt-4o-realtime-preview', - }, - }); rt.send({ type: 'conversation.item.create', diff --git a/jsr.json b/jsr.json index 18d000862..7569332ce 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.81.0", + "version": "4.82.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 07faa0019..42e00822d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.81.0", + "version": "4.82.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 3de224d90..f860579d3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -451,6 +451,7 @@ export declare namespace OpenAI { export type ErrorObject = API.ErrorObject; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; + export type Metadata = API.Metadata; export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; export type ResponseFormatText = API.ResponseFormatText; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 0b6da4620..6d0a07e1e 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -166,8 +166,8 @@ export interface TranscriptionCreateParams< /** * The language of the input audio. Supplying the input language in - * [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will - * improve accuracy and latency. + * [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) + * format will improve accuracy and latency. */ language?: string; diff --git a/src/resources/batches.ts b/src/resources/batches.ts index ec5ca6331..aadda83a6 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -4,6 +4,7 @@ import { APIResource } from '../resource'; import { isRequestOptions } from '../core'; import * as Core from '../core'; import * as BatchesAPI from './batches'; +import * as Shared from './shared'; import { CursorPage, type CursorPageParams } from '../pagination'; export class Batches extends APIResource { @@ -138,11 +139,13 @@ export interface Batch { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * The ID of the file containing the outputs of successfully executed requests. @@ -237,9 +240,14 @@ export interface BatchCreateParams { input_file_id: string; /** - * Optional custom metadata for the batch. + * Set of 16 key-value pairs that can be attached to an object. This can be useful + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: Record | null; + metadata?: Shared.Metadata | null; } export interface BatchListParams extends CursorPageParams {} diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 0e657b1d4..69a5db520 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -111,11 +111,13 @@ export interface Assistant { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata: unknown | null; + metadata: Shared.Metadata | null; /** * ID of the model to use. You can use the @@ -1118,11 +1120,13 @@ export interface AssistantCreateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * The name of the assistant. The maximum length is 256 characters. @@ -1242,12 +1246,14 @@ export namespace AssistantCreateParams { file_ids?: Array; /** - * Set of 16 key-value pairs that can be attached to a vector store. This can be - * useful for storing additional information about the vector store in a structured - * format. Keys can be a maximum of 64 characters long and values can be a maxium - * of 512 characters long. + * Set of 16 key-value pairs that can be attached to an object. This can be useful + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown; + metadata?: Shared.Metadata | null; } } } @@ -1267,11 +1273,13 @@ export interface AssistantUpdateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * ID of the model to use. You can use the diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 0fb66eb49..c666221e1 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../resource'; import * as RealtimeAPI from './realtime'; +import * as Shared from '../../shared'; import * as SessionsAPI from './sessions'; import { Session as SessionsAPISession, @@ -741,9 +742,38 @@ export interface RealtimeResponse { id?: string; /** - * Developer-provided string key-value pairs associated with this response. + * Which conversation the response is added to, determined by the `conversation` + * field in the `response.create` event. If `auto`, the response will be added to + * the default conversation and the value of `conversation_id` will be an id like + * `conv_1234`. If `none`, the response will not be added to any conversation and + * the value of `conversation_id` will be `null`. If responses are being triggered + * by server VAD, the response will be added to the default conversation, thus the + * `conversation_id` will be an id like `conv_1234`. */ - metadata?: unknown | null; + conversation_id?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls, that was used in this response. + */ + max_output_tokens?: number | 'inf'; + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. + */ + metadata?: Shared.Metadata | null; + + /** + * The set of modalities the model used to respond. If there are multiple + * modalities, the model will pick one, for example if `modalities` is + * `["text", "audio"]`, the model could be responding in either text or audio. + */ + modalities?: Array<'text' | 'audio'>; /** * The object type, must be `realtime.response`. @@ -755,6 +785,11 @@ export interface RealtimeResponse { */ output?: Array; + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** * The final status of the response (`completed`, `cancelled`, `failed`, or * `incomplete`). @@ -766,6 +801,11 @@ export interface RealtimeResponse { */ status_details?: RealtimeResponseStatus; + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + /** * Usage statistics for the Response, this will correspond to billing. A Realtime * API session will maintain a conversation context and append new Items to the @@ -773,6 +813,12 @@ export interface RealtimeResponse { * become the input for later turns. */ usage?: RealtimeResponseUsage; + + /** + * The voice the model used to respond. Current voice options are `alloy`, `ash`, + * `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; } /** @@ -1320,11 +1366,13 @@ export namespace ResponseCreateEvent { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maximum of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * The set of modalities the model can respond with. To disable audio, set this to @@ -1716,8 +1764,11 @@ export namespace SessionUpdateEvent { * Configuration for input audio transcription, defaults to off and can be set to * `null` to turn off once on. Input audio transcription is not native to the * model, since the model consumes audio directly. Transcription runs - * asynchronously through Whisper and should be treated as rough guidance rather - * than the representation understood by the model. + * asynchronously through + * [OpenAI Whisper transcription](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as rough guidance rather than the representation + * understood by the model. The client can optionally set the language and prompt + * for transcription, these fields will be passed to the Whisper API. */ input_audio_transcription?: Session.InputAudioTranscription; @@ -1801,15 +1852,33 @@ export namespace SessionUpdateEvent { * Configuration for input audio transcription, defaults to off and can be set to * `null` to turn off once on. Input audio transcription is not native to the * model, since the model consumes audio directly. Transcription runs - * asynchronously through Whisper and should be treated as rough guidance rather - * than the representation understood by the model. + * asynchronously through + * [OpenAI Whisper transcription](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as rough guidance rather than the representation + * understood by the model. The client can optionally set the language and prompt + * for transcription, these fields will be passed to the Whisper API. */ export interface InputAudioTranscription { + /** + * The language of the input audio. Supplying the input language in + * [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) + * format will improve accuracy and latency. + */ + language?: string; + /** * The model to use for transcription, `whisper-1` is the only currently supported * model. */ model?: string; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. The + * [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) + * should match the audio language. + */ + prompt?: string; } export interface Tool { diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 68c48db59..d2afa25b1 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -203,7 +203,7 @@ export interface SessionCreateResponse { /** * Ephemeral key returned by the API. */ - client_secret?: SessionCreateResponse.ClientSecret; + client_secret: SessionCreateResponse.ClientSecret; /** * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. @@ -292,14 +292,14 @@ export namespace SessionCreateResponse { * Timestamp for when the token expires. Currently, all tokens expire after one * minute. */ - expires_at?: number; + expires_at: number; /** * Ephemeral key usable in client environments to authenticate connections to the * Realtime API. Use this in client-side environments rather than a standard API * token, which should only be used server-side. */ - value?: string; + value: string; } /** @@ -385,8 +385,11 @@ export interface SessionCreateParams { * Configuration for input audio transcription, defaults to off and can be set to * `null` to turn off once on. Input audio transcription is not native to the * model, since the model consumes audio directly. Transcription runs - * asynchronously through Whisper and should be treated as rough guidance rather - * than the representation understood by the model. + * asynchronously through + * [OpenAI Whisper transcription](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as rough guidance rather than the representation + * understood by the model. The client can optionally set the language and prompt + * for transcription, these fields will be passed to the Whisper API. */ input_audio_transcription?: SessionCreateParams.InputAudioTranscription; @@ -470,15 +473,33 @@ export namespace SessionCreateParams { * Configuration for input audio transcription, defaults to off and can be set to * `null` to turn off once on. Input audio transcription is not native to the * model, since the model consumes audio directly. Transcription runs - * asynchronously through Whisper and should be treated as rough guidance rather - * than the representation understood by the model. + * asynchronously through + * [OpenAI Whisper transcription](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as rough guidance rather than the representation + * understood by the model. The client can optionally set the language and prompt + * for transcription, these fields will be passed to the Whisper API. */ export interface InputAudioTranscription { + /** + * The language of the input audio. Supplying the input language in + * [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) + * format will improve accuracy and latency. + */ + language?: string; + /** * The model to use for transcription, `whisper-1` is the only currently supported * model. */ model?: string; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. The + * [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) + * should match the audio language. + */ + prompt?: string; } export interface Tool { diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 8124f56cd..29fd2b29f 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -3,6 +3,7 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; +import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; import { CursorPage, type CursorPageParams } from '../../../pagination'; @@ -407,11 +408,13 @@ export interface Message { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata: unknown | null; + metadata: Shared.Metadata | null; /** * The object type, which is always `thread.message`. @@ -660,11 +663,13 @@ export interface MessageCreateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; } export namespace MessageCreateParams { @@ -693,11 +698,13 @@ export namespace MessageCreateParams { export interface MessageUpdateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; } export interface MessageListParams extends CursorPageParams { diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 814ad3e89..84ba7b63c 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -8,6 +8,7 @@ import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/Assi import { sleep } from '../../../../core'; import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream'; import * as RunsAPI from './runs'; +import * as Shared from '../../../shared'; import * as AssistantsAPI from '../../assistants'; import * as ChatAPI from '../../../chat/chat'; import * as MessagesAPI from '../messages'; @@ -415,11 +416,13 @@ export interface Run { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata: unknown | null; + metadata: Shared.Metadata | null; /** * The model that the @@ -705,10 +708,12 @@ export interface RunCreateParamsBase { /** * Body param: Set of 16 key-value pairs that can be attached to an object. This * can be useful for storing additional information about the object in a - * structured format. Keys can be a maximum of 64 characters long and values can be - * a maxium of 512 characters long. + * structured format, and querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * Body param: The ID of the @@ -823,11 +828,13 @@ export namespace RunCreateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; } export namespace AdditionalMessage { @@ -898,11 +905,13 @@ export interface RunCreateParamsStreaming extends RunCreateParamsBase { export interface RunUpdateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; } export interface RunListParams extends CursorPageParams { diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 6c6722b62..c491b4e83 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; import * as StepsAPI from './steps'; +import * as Shared from '../../../shared'; import { CursorPage, type CursorPageParams } from '../../../../pagination'; export class Steps extends APIResource { @@ -515,11 +516,13 @@ export interface RunStep { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata: unknown | null; + metadata: Shared.Metadata | null; /** * The object type, which is always `thread.run.step`. diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 453d8fa10..3f69c6e60 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -250,11 +250,13 @@ export interface Thread { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata: unknown | null; + metadata: Shared.Metadata | null; /** * The object type, which is always `thread`. @@ -322,11 +324,13 @@ export interface ThreadCreateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * A set of resources that are made available to the assistant's tools in this @@ -361,11 +365,13 @@ export namespace ThreadCreateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; } export namespace Message { @@ -447,12 +453,14 @@ export namespace ThreadCreateParams { file_ids?: Array; /** - * Set of 16 key-value pairs that can be attached to a vector store. This can be - * useful for storing additional information about the vector store in a structured - * format. Keys can be a maximum of 64 characters long and values can be a maxium - * of 512 characters long. + * Set of 16 key-value pairs that can be attached to an object. This can be useful + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown; + metadata?: Shared.Metadata | null; } } } @@ -461,11 +469,13 @@ export namespace ThreadCreateParams { export interface ThreadUpdateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * A set of resources that are made available to the assistant's tools in this @@ -549,11 +559,13 @@ export interface ThreadCreateAndRunParamsBase { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to @@ -609,7 +621,8 @@ export interface ThreadCreateAndRunParamsBase { temperature?: number | null; /** - * If no thread is provided, an empty thread will be created. + * Options to create a new thread. If no thread is provided when running a request, + * an empty thread will be created. */ thread?: ThreadCreateAndRunParams.Thread; @@ -658,7 +671,8 @@ export interface ThreadCreateAndRunParamsBase { export namespace ThreadCreateAndRunParams { /** - * If no thread is provided, an empty thread will be created. + * Options to create a new thread. If no thread is provided when running a request, + * an empty thread will be created. */ export interface Thread { /** @@ -669,11 +683,13 @@ export namespace ThreadCreateAndRunParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * A set of resources that are made available to the assistant's tools in this @@ -708,11 +724,13 @@ export namespace ThreadCreateAndRunParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; } export namespace Message { @@ -794,12 +812,14 @@ export namespace ThreadCreateAndRunParams { file_ids?: Array; /** - * Set of 16 key-value pairs that can be attached to a vector store. This can be - * useful for storing additional information about the vector store in a structured - * format. Keys can be a maximum of 64 characters long and values can be a maxium - * of 512 characters long. + * Set of 16 key-value pairs that can be attached to an object. This can be useful + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown; + metadata?: Shared.Metadata | null; } } } diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index cbff2d562..8438b79da 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -3,6 +3,7 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; +import * as Shared from '../../shared'; import * as FileBatchesAPI from './file-batches'; import { FileBatchCreateParams, @@ -187,11 +188,13 @@ export interface VectorStore { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata: unknown | null; + metadata: Shared.Metadata | null; /** * The name of the vector store. @@ -300,11 +303,13 @@ export interface VectorStoreCreateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * The name of the vector store. @@ -338,11 +343,13 @@ export interface VectorStoreUpdateParams { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful - * for storing additional information about the object in a structured format. Keys - * can be a maximum of 64 characters long and values can be a maxium of 512 - * characters long. + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: unknown | null; + metadata?: Shared.Metadata | null; /** * The name of the vector store. diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 2230b19bd..d4a18929c 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -46,6 +46,8 @@ export class Chat extends APIResource { } export type ChatModel = + | 'o3-mini' + | 'o3-mini-2025-01-31' | 'o1' | 'o1-2024-12-17' | 'o1-preview' diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 683eb5ed4..d2de11458 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -1012,10 +1012,14 @@ export interface ChatCompletionCreateParamsBase { max_tokens?: number | null; /** - * Developer-defined tags and values used for filtering completions in the - * [dashboard](https://platform.openai.com/chat-completions). + * Set of 16 key-value pairs that can be attached to an object. This can be useful + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. */ - metadata?: Record | null; + metadata?: Shared.Metadata | null; /** * Output types that you would like the model to generate for this request. Most @@ -1109,9 +1113,9 @@ export interface ChatCompletionCreateParamsBase { * utilize scale tier credits until they are exhausted. * - If set to 'auto', and the Project is not Scale tier enabled, the request will * be processed using the default service tier with a lower uptime SLA and no - * latency guarentee. + * latency guarantee. * - If set to 'default', the request will be processed using the default service - * tier with a lower uptime SLA and no latency guarentee. + * tier with a lower uptime SLA and no latency guarantee. * - When not set, the default behavior is 'auto'. */ service_tier?: 'auto' | 'default' | null; diff --git a/src/resources/shared.ts b/src/resources/shared.ts index f44fda8a7..3bb11582f 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -55,6 +55,16 @@ export interface FunctionDefinition { */ export type FunctionParameters = Record; +/** + * Set of 16 key-value pairs that can be attached to an object. This can be useful + * for storing additional information about the object in a structured format, and + * querying for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with + * a maximum length of 512 characters. + */ +export type Metadata = Record; + export interface ResponseFormatJSONObject { /** * The type of response format being defined: `json_object` diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index 8491d0fe2..bfe752cd7 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -113,7 +113,7 @@ export interface Upload { status: 'pending' | 'completed' | 'cancelled' | 'expired'; /** - * The ready File object after the Upload is completed. + * The `File` object represents a document that has been uploaded to OpenAI. */ file?: FilesAPI.FileObject | null; } diff --git a/src/version.ts b/src/version.ts index 3b4d4eee5..07241a8cf 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.81.0'; // x-release-please-version +export const VERSION = '4.82.0'; // x-release-please-version diff --git a/tests/api-resources/beta/assistants.test.ts b/tests/api-resources/beta/assistants.test.ts index a64465c77..88a10ba8f 100644 --- a/tests/api-resources/beta/assistants.test.ts +++ b/tests/api-resources/beta/assistants.test.ts @@ -25,7 +25,7 @@ describe('resource assistants', () => { model: 'gpt-4o', description: 'description', instructions: 'instructions', - metadata: {}, + metadata: { foo: 'string' }, name: 'name', response_format: 'auto', temperature: 1, @@ -33,7 +33,9 @@ describe('resource assistants', () => { code_interpreter: { file_ids: ['string'] }, file_search: { vector_store_ids: ['string'], - vector_stores: [{ chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: {} }], + vector_stores: [ + { chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: { foo: 'string' } }, + ], }, }, tools: [{ type: 'code_interpreter' }], diff --git a/tests/api-resources/beta/threads/messages.test.ts b/tests/api-resources/beta/threads/messages.test.ts index c1f5f7b6e..e125edd84 100644 --- a/tests/api-resources/beta/threads/messages.test.ts +++ b/tests/api-resources/beta/threads/messages.test.ts @@ -28,7 +28,7 @@ describe('resource messages', () => { content: 'string', role: 'user', attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], - metadata: {}, + metadata: { foo: 'string' }, }); }); diff --git a/tests/api-resources/beta/threads/runs/runs.test.ts b/tests/api-resources/beta/threads/runs/runs.test.ts index 4fd8261ac..9b728403f 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -30,13 +30,13 @@ describe('resource runs', () => { content: 'string', role: 'user', attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], - metadata: {}, + metadata: { foo: 'string' }, }, ], instructions: 'instructions', max_completion_tokens: 256, max_prompt_tokens: 256, - metadata: {}, + metadata: { foo: 'string' }, model: 'gpt-4o', parallel_tool_calls: true, response_format: 'auto', diff --git a/tests/api-resources/beta/threads/threads.test.ts b/tests/api-resources/beta/threads/threads.test.ts index aba266316..f26d6ec44 100644 --- a/tests/api-resources/beta/threads/threads.test.ts +++ b/tests/api-resources/beta/threads/threads.test.ts @@ -37,15 +37,17 @@ describe('resource threads', () => { content: 'string', role: 'user', attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], - metadata: {}, + metadata: { foo: 'string' }, }, ], - metadata: {}, + metadata: { foo: 'string' }, tool_resources: { code_interpreter: { file_ids: ['string'] }, file_search: { vector_store_ids: ['string'], - vector_stores: [{ chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: {} }], + vector_stores: [ + { chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: { foo: 'string' } }, + ], }, }, }, @@ -118,7 +120,7 @@ describe('resource threads', () => { instructions: 'instructions', max_completion_tokens: 256, max_prompt_tokens: 256, - metadata: {}, + metadata: { foo: 'string' }, model: 'gpt-4o', parallel_tool_calls: true, response_format: 'auto', @@ -130,15 +132,17 @@ describe('resource threads', () => { content: 'string', role: 'user', attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], - metadata: {}, + metadata: { foo: 'string' }, }, ], - metadata: {}, + metadata: { foo: 'string' }, tool_resources: { code_interpreter: { file_ids: ['string'] }, file_search: { vector_store_ids: ['string'], - vector_stores: [{ chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: {} }], + vector_stores: [ + { chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: { foo: 'string' } }, + ], }, }, },